{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# Compute GitHub Stats"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Notebook setup"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {},
   "outputs": [],
   "source": [
    "import os\n",
    "import subprocess\n",
    "if os.path.exists(\"/var/run/secrets/kubernetes.io/serviceaccount\"):\n",
    "    subprocess.check_call([\"pip\", \"install\", \"--user\", \"-r\", \"requirements.txt\"], stderr=subprocess.STDOUT, bufsize=1)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "metadata": {},
   "outputs": [],
   "source": [
    "# NOTE: The RuntimeWarnings (if any) are harmless. See ContinuumIO/anaconda-issues#6678.\n",
    "import altair as alt\n",
    "from pandas.io import gbq\n",
    "import pandas as pd\n",
    "import numpy as np\n",
    "\n",
    "from importlib import reload\n",
    "import itertools"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "metadata": {},
   "outputs": [],
   "source": [
    "import getpass\n",
    "import subprocess\n",
    "# Configuration Variables. Modify as desired.\n",
    "\n",
    "PROJECT = subprocess.check_output([\"gcloud\", \"config\", \"get-value\", \"project\"]).strip().decode()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "metadata": {},
   "outputs": [],
   "source": [
    "#matplotlib"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Setup Authorization\n",
    "\n",
    "If you are using a service account run\n",
    "%%bash\n",
    "\n",
    "# Activate Service Account provided by Kubeflow.\n",
    "gcloud auth activate-service-account --key-file=${GOOGLE_APPLICATION_CREDENTIALS}\n",
    "\n",
    "If you are running using user credentials\n",
    "\n",
    "gcloud auth application-default login"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "metadata": {},
   "outputs": [],
   "source": [
    "import datetime\n",
    "month = datetime.datetime.now().month\n",
    "year = datetime.datetime.now().year\n",
    "\n",
    "num_months = 12\n",
    "\n",
    "months = []\n",
    "for i in range(num_months):\n",
    "    months.append(\"\\\"{0}{1:02}\\\"\".format(year, month))\n",
    "    month -= 1\n",
    "    if month == 0:\n",
    "        month = 12\n",
    "        year -=1"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Unique PR Creators"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 6,
   "metadata": {},
   "outputs": [
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "Downloading: 100%|██████████| 5936/5936 [00:00<00:00, 7655.28rows/s]\n"
     ]
    }
   ],
   "source": [
    "query = \"\"\"\n",
    "SELECT\n",
    "    DATE(created_at) AS pr_date,\n",
    "    actor.id,\n",
    "    actor.login,\n",
    "    JSON_EXTRACT(payload, '$.pull_request.user.id') as user_id,\n",
    "    JSON_EXTRACT(payload, '$.pull_request.id') as pr_id,\n",
    "    JSON_EXTRACT(payload, '$.pull_request.merged') as merged\n",
    "  FROM `githubarchive.month.*`\n",
    "  WHERE\n",
    "    _TABLE_SUFFIX IN ({0})\n",
    "    AND type = 'PullRequestEvent'\n",
    "    AND org.login = 'kubeflow'\n",
    "    AND JSON_EXTRACT(payload, '$.action') IN ('\"closed\"')\n",
    "\"\"\".format(\",\".join(months))\n",
    "\n",
    "all_prs=gbq.read_gbq(str(query), dialect='standard', project_id=PROJECT)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 7,
   "metadata": {},
   "outputs": [],
   "source": [
    "# Filter PRs to merged PRs\n",
    "v=all_prs[\"merged\"].values == 'true'\n",
    "merged_all_prs = all_prs.iloc[v]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 8,
   "metadata": {},
   "outputs": [],
   "source": [
    "p=pd.Series(data=merged_all_prs[\"user_id\"].values,index=merged_all_prs[\"pr_date\"])\n",
    "p=p.sort_index()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 9,
   "metadata": {},
   "outputs": [],
   "source": [
    "# Some solutions here: https://stackoverflow.com/questions/46470743/how-to-efficiently-compute-a-rolling-unique-count-in-a-pandas-time-series\n",
    "# Need to figure out how to do a time based window\n",
    "\n",
    "# TODO(jlewi): Is there a bug in the rolling window computation? creators ends up having the same number\n",
    "# of rows as p; so we end up with multiple datapoints for each day; but the values aren't the same for\n",
    "# each day. What is causing this effect?\n",
    "creators = p.rolling('28d').apply(lambda arr: pd.Series(arr).nunique())\n",
    "\n",
    "# We need to group the days. Rolling window will create a point for each data point\n",
    "creators_df = pd.DataFrame({\"day\": creators.index, \"num_authors\": creators.values})\n",
    "creators_df = creators_df.groupby(\"day\", as_index=False).max()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 10,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "\n",
       "<div id=\"altair-viz-6710c42472b745cc9def9d205a961b2d\"></div>\n",
       "<script type=\"text/javascript\">\n",
       "  (function(spec, embedOpt){\n",
       "    let outputDiv = document.currentScript.previousElementSibling;\n",
       "    if (outputDiv.id !== \"altair-viz-6710c42472b745cc9def9d205a961b2d\") {\n",
       "      outputDiv = document.getElementById(\"altair-viz-6710c42472b745cc9def9d205a961b2d\");\n",
       "    }\n",
       "    const paths = {\n",
       "      \"vega\": \"https://cdn.jsdelivr.net/npm//vega@5?noext\",\n",
       "      \"vega-lib\": \"https://cdn.jsdelivr.net/npm//vega-lib?noext\",\n",
       "      \"vega-lite\": \"https://cdn.jsdelivr.net/npm//vega-lite@4.8.1?noext\",\n",
       "      \"vega-embed\": \"https://cdn.jsdelivr.net/npm//vega-embed@6?noext\",\n",
       "    };\n",
       "\n",
       "    function loadScript(lib) {\n",
       "      return new Promise(function(resolve, reject) {\n",
       "        var s = document.createElement('script');\n",
       "        s.src = paths[lib];\n",
       "        s.async = true;\n",
       "        s.onload = () => resolve(paths[lib]);\n",
       "        s.onerror = () => reject(`Error loading script: ${paths[lib]}`);\n",
       "        document.getElementsByTagName(\"head\")[0].appendChild(s);\n",
       "      });\n",
       "    }\n",
       "\n",
       "    function showError(err) {\n",
       "      outputDiv.innerHTML = `<div class=\"error\" style=\"color:red;\">${err}</div>`;\n",
       "      throw err;\n",
       "    }\n",
       "\n",
       "    function displayChart(vegaEmbed) {\n",
       "      vegaEmbed(outputDiv, spec, embedOpt)\n",
       "        .catch(err => showError(`Javascript Error: ${err.message}<br>This usually means there's a typo in your chart specification. See the javascript console for the full traceback.`));\n",
       "    }\n",
       "\n",
       "    if(typeof define === \"function\" && define.amd) {\n",
       "      requirejs.config({paths});\n",
       "      require([\"vega-embed\"], displayChart, err => showError(`Error loading script: ${err.message}`));\n",
       "    } else if (typeof vegaEmbed === \"function\") {\n",
       "      displayChart(vegaEmbed);\n",
       "    } else {\n",
       "      loadScript(\"vega\")\n",
       "        .then(() => loadScript(\"vega-lite\"))\n",
       "        .then(() => loadScript(\"vega-embed\"))\n",
       "        .catch(showError)\n",
       "        .then(() => displayChart(vegaEmbed));\n",
       "    }\n",
       "  })({\"config\": {\"view\": {\"continuousWidth\": 400, \"continuousHeight\": 300}}, \"layer\": [{\"mark\": \"line\", \"encoding\": {\"x\": {\"type\": \"temporal\", \"field\": \"day\", \"title\": \"Day\"}, \"y\": {\"type\": \"quantitative\", \"field\": \"num_authors\", \"title\": \"# Unique Authors\"}}, \"selection\": {\"selector001\": {\"type\": \"interval\", \"bind\": \"scales\", \"encodings\": [\"x\", \"y\"]}}, \"title\": \"Unique PR Authors (Last 28 Days)\"}, {\"mark\": \"point\", \"encoding\": {\"x\": {\"type\": \"temporal\", \"field\": \"day\", \"title\": \"Day\"}, \"y\": {\"type\": \"quantitative\", \"field\": \"num_authors\", \"title\": \"# Unique Authors\"}}, \"title\": \"Unique PR Authors (Last 28 Days)\"}], \"data\": {\"name\": \"data-0825536c92b111946e663c74ba0afeaa\"}, \"$schema\": \"https://vega.github.io/schema/vega-lite/v4.8.1.json\", \"datasets\": {\"data-0825536c92b111946e663c74ba0afeaa\": [{\"day\": \"2019-08-01T00:00:00\", \"num_authors\": 11.0}, {\"day\": \"2019-08-02T00:00:00\", \"num_authors\": 18.0}, {\"day\": \"2019-08-03T00:00:00\", \"num_authors\": 20.0}, {\"day\": \"2019-08-04T00:00:00\", \"num_authors\": 23.0}, {\"day\": \"2019-08-05T00:00:00\", \"num_authors\": 27.0}, {\"day\": \"2019-08-06T00:00:00\", \"num_authors\": 40.0}, {\"day\": \"2019-08-07T00:00:00\", \"num_authors\": 48.0}, {\"day\": \"2019-08-08T00:00:00\", \"num_authors\": 54.0}, {\"day\": \"2019-08-09T00:00:00\", \"num_authors\": 58.0}, {\"day\": \"2019-08-10T00:00:00\", \"num_authors\": 58.0}, {\"day\": \"2019-08-11T00:00:00\", \"num_authors\": 60.0}, {\"day\": \"2019-08-12T00:00:00\", \"num_authors\": 65.0}, {\"day\": \"2019-08-13T00:00:00\", \"num_authors\": 66.0}, {\"day\": \"2019-08-14T00:00:00\", \"num_authors\": 68.0}, {\"day\": \"2019-08-15T00:00:00\", \"num_authors\": 72.0}, {\"day\": \"2019-08-16T00:00:00\", \"num_authors\": 76.0}, {\"day\": \"2019-08-17T00:00:00\", \"num_authors\": 76.0}, {\"day\": \"2019-08-18T00:00:00\", \"num_authors\": 77.0}, {\"day\": \"2019-08-19T00:00:00\", \"num_authors\": 79.0}, {\"day\": \"2019-08-20T00:00:00\", \"num_authors\": 87.0}, {\"day\": \"2019-08-21T00:00:00\", \"num_authors\": 88.0}, {\"day\": \"2019-08-22T00:00:00\", \"num_authors\": 92.0}, {\"day\": \"2019-08-23T00:00:00\", \"num_authors\": 95.0}, {\"day\": \"2019-08-24T00:00:00\", \"num_authors\": 96.0}, {\"day\": \"2019-08-25T00:00:00\", \"num_authors\": 96.0}, {\"day\": \"2019-08-26T00:00:00\", \"num_authors\": 96.0}, {\"day\": \"2019-08-28T00:00:00\", \"num_authors\": 98.0}, {\"day\": \"2019-08-29T00:00:00\", \"num_authors\": 100.0}, {\"day\": \"2019-08-30T00:00:00\", \"num_authors\": 98.0}, {\"day\": \"2019-08-31T00:00:00\", \"num_authors\": 97.0}, {\"day\": \"2019-09-01T00:00:00\", \"num_authors\": 96.0}, {\"day\": \"2019-09-02T00:00:00\", \"num_authors\": 96.0}, {\"day\": \"2019-09-03T00:00:00\", \"num_authors\": 93.0}, {\"day\": \"2019-09-04T00:00:00\", \"num_authors\": 97.0}, {\"day\": \"2019-09-05T00:00:00\", \"num_authors\": 97.0}, {\"day\": \"2019-09-06T00:00:00\", \"num_authors\": 95.0}, {\"day\": \"2019-09-07T00:00:00\", \"num_authors\": 95.0}, {\"day\": \"2019-09-08T00:00:00\", \"num_authors\": 94.0}, {\"day\": \"2019-09-09T00:00:00\", \"num_authors\": 90.0}, {\"day\": \"2019-09-10T00:00:00\", \"num_authors\": 91.0}, {\"day\": \"2019-09-11T00:00:00\", \"num_authors\": 92.0}, {\"day\": \"2019-09-12T00:00:00\", \"num_authors\": 87.0}, {\"day\": \"2019-09-13T00:00:00\", \"num_authors\": 86.0}, {\"day\": \"2019-09-14T00:00:00\", \"num_authors\": 85.0}, {\"day\": \"2019-09-15T00:00:00\", \"num_authors\": 85.0}, {\"day\": \"2019-09-16T00:00:00\", \"num_authors\": 86.0}, {\"day\": \"2019-09-17T00:00:00\", \"num_authors\": 80.0}, {\"day\": \"2019-09-18T00:00:00\", \"num_authors\": 79.0}, {\"day\": \"2019-09-19T00:00:00\", \"num_authors\": 76.0}, {\"day\": \"2019-09-20T00:00:00\", \"num_authors\": 73.0}, {\"day\": \"2019-09-21T00:00:00\", \"num_authors\": 76.0}, {\"day\": \"2019-09-22T00:00:00\", \"num_authors\": 76.0}, {\"day\": \"2019-09-23T00:00:00\", \"num_authors\": 76.0}, {\"day\": \"2019-09-24T00:00:00\", \"num_authors\": 76.0}, {\"day\": \"2019-09-25T00:00:00\", \"num_authors\": 79.0}, {\"day\": \"2019-09-26T00:00:00\", \"num_authors\": 79.0}, {\"day\": \"2019-09-27T00:00:00\", \"num_authors\": 78.0}, {\"day\": \"2019-09-28T00:00:00\", \"num_authors\": 78.0}, {\"day\": \"2019-09-29T00:00:00\", \"num_authors\": 78.0}, {\"day\": \"2019-09-30T00:00:00\", \"num_authors\": 78.0}, {\"day\": \"2019-10-01T00:00:00\", \"num_authors\": 81.0}, {\"day\": \"2019-10-02T00:00:00\", \"num_authors\": 79.0}, {\"day\": \"2019-10-03T00:00:00\", \"num_authors\": 78.0}, {\"day\": \"2019-10-04T00:00:00\", \"num_authors\": 77.0}, {\"day\": \"2019-10-05T00:00:00\", \"num_authors\": 76.0}, {\"day\": \"2019-10-06T00:00:00\", \"num_authors\": 77.0}, {\"day\": \"2019-10-07T00:00:00\", \"num_authors\": 79.0}, {\"day\": \"2019-10-08T00:00:00\", \"num_authors\": 78.0}, {\"day\": \"2019-10-09T00:00:00\", \"num_authors\": 77.0}, {\"day\": \"2019-10-10T00:00:00\", \"num_authors\": 79.0}, {\"day\": \"2019-10-11T00:00:00\", \"num_authors\": 76.0}, {\"day\": \"2019-10-12T00:00:00\", \"num_authors\": 79.0}, {\"day\": \"2019-10-13T00:00:00\", \"num_authors\": 79.0}, {\"day\": \"2019-10-14T00:00:00\", \"num_authors\": 80.0}, {\"day\": \"2019-10-15T00:00:00\", \"num_authors\": 80.0}, {\"day\": \"2019-10-16T00:00:00\", \"num_authors\": 83.0}, {\"day\": \"2019-10-17T00:00:00\", \"num_authors\": 85.0}, {\"day\": \"2019-10-18T00:00:00\", \"num_authors\": 86.0}, {\"day\": \"2019-10-19T00:00:00\", \"num_authors\": 85.0}, {\"day\": \"2019-10-21T00:00:00\", \"num_authors\": 86.0}, {\"day\": \"2019-10-22T00:00:00\", \"num_authors\": 85.0}, {\"day\": \"2019-10-23T00:00:00\", \"num_authors\": 84.0}, {\"day\": \"2019-10-24T00:00:00\", \"num_authors\": 85.0}, {\"day\": \"2019-10-25T00:00:00\", \"num_authors\": 87.0}, {\"day\": \"2019-10-26T00:00:00\", \"num_authors\": 87.0}, {\"day\": \"2019-10-27T00:00:00\", \"num_authors\": 87.0}, {\"day\": \"2019-10-28T00:00:00\", \"num_authors\": 85.0}, {\"day\": \"2019-10-29T00:00:00\", \"num_authors\": 86.0}, {\"day\": \"2019-10-30T00:00:00\", \"num_authors\": 83.0}, {\"day\": \"2019-10-31T00:00:00\", \"num_authors\": 83.0}, {\"day\": \"2019-11-01T00:00:00\", \"num_authors\": 85.0}, {\"day\": \"2019-11-02T00:00:00\", \"num_authors\": 86.0}, {\"day\": \"2019-11-03T00:00:00\", \"num_authors\": 84.0}, {\"day\": \"2019-11-04T00:00:00\", \"num_authors\": 84.0}, {\"day\": \"2019-11-05T00:00:00\", \"num_authors\": 83.0}, {\"day\": \"2019-11-06T00:00:00\", \"num_authors\": 82.0}, {\"day\": \"2019-11-07T00:00:00\", \"num_authors\": 83.0}, {\"day\": \"2019-11-08T00:00:00\", \"num_authors\": 83.0}, {\"day\": \"2019-11-09T00:00:00\", \"num_authors\": 79.0}, {\"day\": \"2019-11-10T00:00:00\", \"num_authors\": 80.0}, {\"day\": \"2019-11-11T00:00:00\", \"num_authors\": 80.0}, {\"day\": \"2019-11-12T00:00:00\", \"num_authors\": 81.0}, {\"day\": \"2019-11-13T00:00:00\", \"num_authors\": 79.0}, {\"day\": \"2019-11-14T00:00:00\", \"num_authors\": 91.0}, {\"day\": \"2019-11-15T00:00:00\", \"num_authors\": 91.0}, {\"day\": \"2019-11-16T00:00:00\", \"num_authors\": 89.0}, {\"day\": \"2019-11-18T00:00:00\", \"num_authors\": 88.0}, {\"day\": \"2019-11-19T00:00:00\", \"num_authors\": 89.0}, {\"day\": \"2019-11-20T00:00:00\", \"num_authors\": 85.0}, {\"day\": \"2019-11-21T00:00:00\", \"num_authors\": 85.0}, {\"day\": \"2019-11-22T00:00:00\", \"num_authors\": 86.0}, {\"day\": \"2019-11-23T00:00:00\", \"num_authors\": 86.0}, {\"day\": \"2019-11-24T00:00:00\", \"num_authors\": 86.0}, {\"day\": \"2019-11-25T00:00:00\", \"num_authors\": 86.0}, {\"day\": \"2019-11-26T00:00:00\", \"num_authors\": 86.0}, {\"day\": \"2019-11-27T00:00:00\", \"num_authors\": 86.0}, {\"day\": \"2019-11-28T00:00:00\", \"num_authors\": 89.0}, {\"day\": \"2019-11-29T00:00:00\", \"num_authors\": 87.0}, {\"day\": \"2019-12-01T00:00:00\", \"num_authors\": 86.0}, {\"day\": \"2019-12-02T00:00:00\", \"num_authors\": 87.0}, {\"day\": \"2019-12-03T00:00:00\", \"num_authors\": 90.0}, {\"day\": \"2019-12-04T00:00:00\", \"num_authors\": 89.0}, {\"day\": \"2019-12-05T00:00:00\", \"num_authors\": 91.0}, {\"day\": \"2019-12-06T00:00:00\", \"num_authors\": 88.0}, {\"day\": \"2019-12-07T00:00:00\", \"num_authors\": 89.0}, {\"day\": \"2019-12-08T00:00:00\", \"num_authors\": 88.0}, {\"day\": \"2019-12-09T00:00:00\", \"num_authors\": 89.0}, {\"day\": \"2019-12-10T00:00:00\", \"num_authors\": 86.0}, {\"day\": \"2019-12-11T00:00:00\", \"num_authors\": 86.0}, {\"day\": \"2019-12-12T00:00:00\", \"num_authors\": 76.0}, {\"day\": \"2019-12-13T00:00:00\", \"num_authors\": 76.0}, {\"day\": \"2019-12-16T00:00:00\", \"num_authors\": 73.0}, {\"day\": \"2019-12-17T00:00:00\", \"num_authors\": 72.0}, {\"day\": \"2019-12-18T00:00:00\", \"num_authors\": 74.0}, {\"day\": \"2019-12-19T00:00:00\", \"num_authors\": 72.0}, {\"day\": \"2019-12-20T00:00:00\", \"num_authors\": 72.0}, {\"day\": \"2019-12-21T00:00:00\", \"num_authors\": 71.0}, {\"day\": \"2019-12-23T00:00:00\", \"num_authors\": 70.0}, {\"day\": \"2019-12-24T00:00:00\", \"num_authors\": 70.0}, {\"day\": \"2019-12-25T00:00:00\", \"num_authors\": 69.0}, {\"day\": \"2019-12-26T00:00:00\", \"num_authors\": 69.0}, {\"day\": \"2019-12-27T00:00:00\", \"num_authors\": 72.0}, {\"day\": \"2019-12-28T00:00:00\", \"num_authors\": 72.0}, {\"day\": \"2019-12-29T00:00:00\", \"num_authors\": 72.0}, {\"day\": \"2019-12-30T00:00:00\", \"num_authors\": 71.0}, {\"day\": \"2019-12-31T00:00:00\", \"num_authors\": 69.0}, {\"day\": \"2020-01-01T00:00:00\", \"num_authors\": 66.0}, {\"day\": \"2020-01-02T00:00:00\", \"num_authors\": 61.0}, {\"day\": \"2020-01-03T00:00:00\", \"num_authors\": 63.0}, {\"day\": \"2020-01-04T00:00:00\", \"num_authors\": 63.0}, {\"day\": \"2020-01-05T00:00:00\", \"num_authors\": 64.0}, {\"day\": \"2020-01-06T00:00:00\", \"num_authors\": 64.0}, {\"day\": \"2020-01-07T00:00:00\", \"num_authors\": 63.0}, {\"day\": \"2020-01-08T00:00:00\", \"num_authors\": 65.0}, {\"day\": \"2020-01-09T00:00:00\", \"num_authors\": 66.0}, {\"day\": \"2020-01-10T00:00:00\", \"num_authors\": 67.0}, {\"day\": \"2020-01-11T00:00:00\", \"num_authors\": 67.0}, {\"day\": \"2020-01-12T00:00:00\", \"num_authors\": 67.0}, {\"day\": \"2020-01-13T00:00:00\", \"num_authors\": 67.0}, {\"day\": \"2020-01-14T00:00:00\", \"num_authors\": 72.0}, {\"day\": \"2020-01-15T00:00:00\", \"num_authors\": 72.0}, {\"day\": \"2020-01-16T00:00:00\", \"num_authors\": 73.0}, {\"day\": \"2020-01-17T00:00:00\", \"num_authors\": 72.0}, {\"day\": \"2020-01-18T00:00:00\", \"num_authors\": 71.0}, {\"day\": \"2020-01-19T00:00:00\", \"num_authors\": 72.0}, {\"day\": \"2020-01-20T00:00:00\", \"num_authors\": 71.0}, {\"day\": \"2020-01-21T00:00:00\", \"num_authors\": 72.0}, {\"day\": \"2020-01-22T00:00:00\", \"num_authors\": 74.0}, {\"day\": \"2020-01-23T00:00:00\", \"num_authors\": 75.0}, {\"day\": \"2020-01-24T00:00:00\", \"num_authors\": 72.0}, {\"day\": \"2020-01-25T00:00:00\", \"num_authors\": 72.0}, {\"day\": \"2020-01-26T00:00:00\", \"num_authors\": 71.0}, {\"day\": \"2020-01-27T00:00:00\", \"num_authors\": 70.0}, {\"day\": \"2020-01-28T00:00:00\", \"num_authors\": 71.0}, {\"day\": \"2020-01-29T00:00:00\", \"num_authors\": 70.0}, {\"day\": \"2020-01-30T00:00:00\", \"num_authors\": 72.0}, {\"day\": \"2020-01-31T00:00:00\", \"num_authors\": 71.0}, {\"day\": \"2020-02-01T00:00:00\", \"num_authors\": 73.0}, {\"day\": \"2020-02-02T00:00:00\", \"num_authors\": 74.0}, {\"day\": \"2020-02-03T00:00:00\", \"num_authors\": 73.0}, {\"day\": \"2020-02-04T00:00:00\", \"num_authors\": 75.0}, {\"day\": \"2020-02-05T00:00:00\", \"num_authors\": 83.0}, {\"day\": \"2020-02-06T00:00:00\", \"num_authors\": 85.0}, {\"day\": \"2020-02-07T00:00:00\", \"num_authors\": 84.0}, {\"day\": \"2020-02-08T00:00:00\", \"num_authors\": 85.0}, {\"day\": \"2020-02-09T00:00:00\", \"num_authors\": 85.0}, {\"day\": \"2020-02-10T00:00:00\", \"num_authors\": 84.0}, {\"day\": \"2020-02-11T00:00:00\", \"num_authors\": 86.0}, {\"day\": \"2020-02-12T00:00:00\", \"num_authors\": 89.0}, {\"day\": \"2020-02-13T00:00:00\", \"num_authors\": 90.0}, {\"day\": \"2020-02-14T00:00:00\", \"num_authors\": 89.0}, {\"day\": \"2020-02-15T00:00:00\", \"num_authors\": 89.0}, {\"day\": \"2020-02-16T00:00:00\", \"num_authors\": 89.0}, {\"day\": \"2020-02-17T00:00:00\", \"num_authors\": 87.0}, {\"day\": \"2020-02-18T00:00:00\", \"num_authors\": 84.0}, {\"day\": \"2020-02-19T00:00:00\", \"num_authors\": 87.0}, {\"day\": \"2020-02-20T00:00:00\", \"num_authors\": 88.0}, {\"day\": \"2020-02-21T00:00:00\", \"num_authors\": 93.0}, {\"day\": \"2020-02-22T00:00:00\", \"num_authors\": 93.0}, {\"day\": \"2020-02-23T00:00:00\", \"num_authors\": 94.0}, {\"day\": \"2020-02-24T00:00:00\", \"num_authors\": 97.0}, {\"day\": \"2020-02-25T00:00:00\", \"num_authors\": 97.0}, {\"day\": \"2020-02-26T00:00:00\", \"num_authors\": 100.0}, {\"day\": \"2020-02-27T00:00:00\", \"num_authors\": 99.0}, {\"day\": \"2020-02-28T00:00:00\", \"num_authors\": 99.0}, {\"day\": \"2020-02-29T00:00:00\", \"num_authors\": 99.0}, {\"day\": \"2020-03-01T00:00:00\", \"num_authors\": 99.0}, {\"day\": \"2020-03-02T00:00:00\", \"num_authors\": 96.0}, {\"day\": \"2020-03-03T00:00:00\", \"num_authors\": 99.0}, {\"day\": \"2020-03-04T00:00:00\", \"num_authors\": 92.0}, {\"day\": \"2020-03-05T00:00:00\", \"num_authors\": 94.0}, {\"day\": \"2020-03-06T00:00:00\", \"num_authors\": 95.0}, {\"day\": \"2020-03-07T00:00:00\", \"num_authors\": 96.0}, {\"day\": \"2020-03-08T00:00:00\", \"num_authors\": 96.0}, {\"day\": \"2020-03-09T00:00:00\", \"num_authors\": 98.0}, {\"day\": \"2020-03-10T00:00:00\", \"num_authors\": 96.0}, {\"day\": \"2020-03-11T00:00:00\", \"num_authors\": 95.0}, {\"day\": \"2020-03-12T00:00:00\", \"num_authors\": 94.0}, {\"day\": \"2020-03-13T00:00:00\", \"num_authors\": 95.0}, {\"day\": \"2020-03-14T00:00:00\", \"num_authors\": 95.0}, {\"day\": \"2020-03-15T00:00:00\", \"num_authors\": 96.0}, {\"day\": \"2020-03-16T00:00:00\", \"num_authors\": 99.0}, {\"day\": \"2020-03-17T00:00:00\", \"num_authors\": 96.0}, {\"day\": \"2020-03-18T00:00:00\", \"num_authors\": 96.0}, {\"day\": \"2020-03-19T00:00:00\", \"num_authors\": 98.0}, {\"day\": \"2020-03-20T00:00:00\", \"num_authors\": 93.0}, {\"day\": \"2020-03-21T00:00:00\", \"num_authors\": 93.0}, {\"day\": \"2020-03-22T00:00:00\", \"num_authors\": 93.0}, {\"day\": \"2020-03-23T00:00:00\", \"num_authors\": 94.0}, {\"day\": \"2020-03-24T00:00:00\", \"num_authors\": 98.0}, {\"day\": \"2020-03-25T00:00:00\", \"num_authors\": 96.0}, {\"day\": \"2020-03-26T00:00:00\", \"num_authors\": 97.0}, {\"day\": \"2020-03-27T00:00:00\", \"num_authors\": 97.0}, {\"day\": \"2020-03-28T00:00:00\", \"num_authors\": 97.0}, {\"day\": \"2020-03-30T00:00:00\", \"num_authors\": 97.0}, {\"day\": \"2020-03-31T00:00:00\", \"num_authors\": 96.0}, {\"day\": \"2020-04-01T00:00:00\", \"num_authors\": 93.0}, {\"day\": \"2020-04-02T00:00:00\", \"num_authors\": 91.0}, {\"day\": \"2020-04-03T00:00:00\", \"num_authors\": 95.0}, {\"day\": \"2020-04-04T00:00:00\", \"num_authors\": 96.0}, {\"day\": \"2020-04-05T00:00:00\", \"num_authors\": 97.0}, {\"day\": \"2020-04-06T00:00:00\", \"num_authors\": 96.0}, {\"day\": \"2020-04-07T00:00:00\", \"num_authors\": 97.0}, {\"day\": \"2020-04-08T00:00:00\", \"num_authors\": 97.0}, {\"day\": \"2020-04-09T00:00:00\", \"num_authors\": 96.0}, {\"day\": \"2020-04-10T00:00:00\", \"num_authors\": 93.0}, {\"day\": \"2020-04-11T00:00:00\", \"num_authors\": 92.0}, {\"day\": \"2020-04-12T00:00:00\", \"num_authors\": 90.0}, {\"day\": \"2020-04-13T00:00:00\", \"num_authors\": 91.0}, {\"day\": \"2020-04-14T00:00:00\", \"num_authors\": 90.0}, {\"day\": \"2020-04-15T00:00:00\", \"num_authors\": 91.0}, {\"day\": \"2020-04-16T00:00:00\", \"num_authors\": 89.0}, {\"day\": \"2020-04-17T00:00:00\", \"num_authors\": 88.0}, {\"day\": \"2020-04-18T00:00:00\", \"num_authors\": 88.0}, {\"day\": \"2020-04-19T00:00:00\", \"num_authors\": 88.0}, {\"day\": \"2020-04-20T00:00:00\", \"num_authors\": 88.0}, {\"day\": \"2020-04-21T00:00:00\", \"num_authors\": 82.0}, {\"day\": \"2020-04-22T00:00:00\", \"num_authors\": 83.0}, {\"day\": \"2020-04-23T00:00:00\", \"num_authors\": 83.0}, {\"day\": \"2020-04-24T00:00:00\", \"num_authors\": 82.0}, {\"day\": \"2020-04-25T00:00:00\", \"num_authors\": 82.0}, {\"day\": \"2020-04-26T00:00:00\", \"num_authors\": 82.0}, {\"day\": \"2020-04-27T00:00:00\", \"num_authors\": 84.0}, {\"day\": \"2020-04-28T00:00:00\", \"num_authors\": 81.0}, {\"day\": \"2020-04-29T00:00:00\", \"num_authors\": 82.0}, {\"day\": \"2020-04-30T00:00:00\", \"num_authors\": 83.0}, {\"day\": \"2020-05-01T00:00:00\", \"num_authors\": 81.0}, {\"day\": \"2020-05-02T00:00:00\", \"num_authors\": 80.0}, {\"day\": \"2020-05-03T00:00:00\", \"num_authors\": 79.0}, {\"day\": \"2020-05-04T00:00:00\", \"num_authors\": 78.0}, {\"day\": \"2020-05-05T00:00:00\", \"num_authors\": 80.0}, {\"day\": \"2020-05-06T00:00:00\", \"num_authors\": 78.0}, {\"day\": \"2020-05-07T00:00:00\", \"num_authors\": 78.0}, {\"day\": \"2020-05-08T00:00:00\", \"num_authors\": 78.0}, {\"day\": \"2020-05-09T00:00:00\", \"num_authors\": 80.0}, {\"day\": \"2020-05-10T00:00:00\", \"num_authors\": 82.0}, {\"day\": \"2020-05-11T00:00:00\", \"num_authors\": 80.0}, {\"day\": \"2020-05-12T00:00:00\", \"num_authors\": 81.0}, {\"day\": \"2020-05-13T00:00:00\", \"num_authors\": 82.0}, {\"day\": \"2020-05-14T00:00:00\", \"num_authors\": 84.0}, {\"day\": \"2020-05-15T00:00:00\", \"num_authors\": 82.0}, {\"day\": \"2020-05-16T00:00:00\", \"num_authors\": 82.0}, {\"day\": \"2020-05-17T00:00:00\", \"num_authors\": 81.0}, {\"day\": \"2020-05-18T00:00:00\", \"num_authors\": 80.0}, {\"day\": \"2020-05-19T00:00:00\", \"num_authors\": 79.0}, {\"day\": \"2020-05-20T00:00:00\", \"num_authors\": 79.0}, {\"day\": \"2020-05-21T00:00:00\", \"num_authors\": 80.0}, {\"day\": \"2020-05-22T00:00:00\", \"num_authors\": 80.0}, {\"day\": \"2020-05-23T00:00:00\", \"num_authors\": 81.0}, {\"day\": \"2020-05-24T00:00:00\", \"num_authors\": 82.0}, {\"day\": \"2020-05-25T00:00:00\", \"num_authors\": 82.0}, {\"day\": \"2020-05-26T00:00:00\", \"num_authors\": 84.0}, {\"day\": \"2020-05-27T00:00:00\", \"num_authors\": 82.0}, {\"day\": \"2020-05-28T00:00:00\", \"num_authors\": 80.0}, {\"day\": \"2020-05-29T00:00:00\", \"num_authors\": 80.0}, {\"day\": \"2020-05-30T00:00:00\", \"num_authors\": 79.0}, {\"day\": \"2020-05-31T00:00:00\", \"num_authors\": 78.0}, {\"day\": \"2020-06-01T00:00:00\", \"num_authors\": 81.0}, {\"day\": \"2020-06-02T00:00:00\", \"num_authors\": 80.0}, {\"day\": \"2020-06-03T00:00:00\", \"num_authors\": 79.0}, {\"day\": \"2020-06-04T00:00:00\", \"num_authors\": 81.0}, {\"day\": \"2020-06-05T00:00:00\", \"num_authors\": 82.0}, {\"day\": \"2020-06-06T00:00:00\", \"num_authors\": 82.0}, {\"day\": \"2020-06-07T00:00:00\", \"num_authors\": 81.0}, {\"day\": \"2020-06-08T00:00:00\", \"num_authors\": 82.0}, {\"day\": \"2020-06-09T00:00:00\", \"num_authors\": 81.0}, {\"day\": \"2020-06-10T00:00:00\", \"num_authors\": 79.0}, {\"day\": \"2020-06-11T00:00:00\", \"num_authors\": 76.0}, {\"day\": \"2020-06-12T00:00:00\", \"num_authors\": 75.0}, {\"day\": \"2020-06-13T00:00:00\", \"num_authors\": 75.0}, {\"day\": \"2020-06-14T00:00:00\", \"num_authors\": 74.0}, {\"day\": \"2020-06-15T00:00:00\", \"num_authors\": 76.0}, {\"day\": \"2020-06-16T00:00:00\", \"num_authors\": 76.0}, {\"day\": \"2020-06-17T00:00:00\", \"num_authors\": 78.0}, {\"day\": \"2020-06-18T00:00:00\", \"num_authors\": 78.0}, {\"day\": \"2020-06-19T00:00:00\", \"num_authors\": 79.0}, {\"day\": \"2020-06-20T00:00:00\", \"num_authors\": 80.0}, {\"day\": \"2020-06-21T00:00:00\", \"num_authors\": 79.0}, {\"day\": \"2020-06-22T00:00:00\", \"num_authors\": 83.0}, {\"day\": \"2020-06-23T00:00:00\", \"num_authors\": 83.0}, {\"day\": \"2020-06-24T00:00:00\", \"num_authors\": 82.0}, {\"day\": \"2020-06-25T00:00:00\", \"num_authors\": 82.0}, {\"day\": \"2020-06-26T00:00:00\", \"num_authors\": 81.0}, {\"day\": \"2020-06-27T00:00:00\", \"num_authors\": 80.0}, {\"day\": \"2020-06-28T00:00:00\", \"num_authors\": 80.0}, {\"day\": \"2020-06-29T00:00:00\", \"num_authors\": 79.0}, {\"day\": \"2020-06-30T00:00:00\", \"num_authors\": 81.0}, {\"day\": \"2020-07-01T00:00:00\", \"num_authors\": 82.0}, {\"day\": \"2020-07-02T00:00:00\", \"num_authors\": 79.0}, {\"day\": \"2020-07-03T00:00:00\", \"num_authors\": 76.0}, {\"day\": \"2020-07-04T00:00:00\", \"num_authors\": 78.0}, {\"day\": \"2020-07-05T00:00:00\", \"num_authors\": 78.0}, {\"day\": \"2020-07-06T00:00:00\", \"num_authors\": 78.0}, {\"day\": \"2020-07-07T00:00:00\", \"num_authors\": 79.0}, {\"day\": \"2020-07-08T00:00:00\", \"num_authors\": 83.0}, {\"day\": \"2020-07-09T00:00:00\", \"num_authors\": 84.0}, {\"day\": \"2020-07-10T00:00:00\", \"num_authors\": 85.0}, {\"day\": \"2020-07-11T00:00:00\", \"num_authors\": 85.0}, {\"day\": \"2020-07-12T00:00:00\", \"num_authors\": 85.0}, {\"day\": \"2020-07-13T00:00:00\", \"num_authors\": 84.0}, {\"day\": \"2020-07-14T00:00:00\", \"num_authors\": 83.0}, {\"day\": \"2020-07-15T00:00:00\", \"num_authors\": 81.0}, {\"day\": \"2020-07-16T00:00:00\", \"num_authors\": 81.0}, {\"day\": \"2020-07-17T00:00:00\", \"num_authors\": 85.0}, {\"day\": \"2020-07-18T00:00:00\", \"num_authors\": 85.0}, {\"day\": \"2020-07-20T00:00:00\", \"num_authors\": 80.0}, {\"day\": \"2020-07-21T00:00:00\", \"num_authors\": 76.0}, {\"day\": \"2020-07-22T00:00:00\", \"num_authors\": 81.0}, {\"day\": \"2020-07-23T00:00:00\", \"num_authors\": 85.0}, {\"day\": \"2020-07-24T00:00:00\", \"num_authors\": 85.0}]}}, {\"mode\": \"vega-lite\"});\n",
       "</script>"
      ],
      "text/plain": [
       "alt.LayerChart(...)"
      ]
     },
     "execution_count": 10,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "import altair as alt\n",
    "chart = alt.Chart(creators_df, title= \"Unique PR Authors (Last 28 Days)\")\n",
    "line = chart.mark_line().encode(\n",
    "  x= alt.X('day', title = \"Day\"),\n",
    "  y=alt.Y(\"num_authors\", title=\"# Unique Authors\"),    \n",
    ")\n",
    "\n",
    "point = line + line.mark_point()\n",
    "point.interactive()"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### Number Prs"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 11,
   "metadata": {},
   "outputs": [],
   "source": [
    "pr_impulse=pd.Series(data=merged_all_prs[\"pr_id\"].values,index=merged_all_prs[\"pr_date\"])\n",
    "pr_impulse=pr_impulse.sort_index()\n",
    "\n",
    "unique_prs = pr_impulse.rolling('28d').apply(lambda arr: pd.Series(arr).nunique())\n",
    "\n",
    "prs_df = pd.DataFrame({\"day\": unique_prs.index, \"num_prs\": unique_prs.values})\n",
    "prs_df = prs_df.groupby(\"day\", as_index=False).max()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 12,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "\n",
       "<div id=\"altair-viz-d7fa0e20f22d4ae3a4ccec9f000ca39e\"></div>\n",
       "<script type=\"text/javascript\">\n",
       "  (function(spec, embedOpt){\n",
       "    let outputDiv = document.currentScript.previousElementSibling;\n",
       "    if (outputDiv.id !== \"altair-viz-d7fa0e20f22d4ae3a4ccec9f000ca39e\") {\n",
       "      outputDiv = document.getElementById(\"altair-viz-d7fa0e20f22d4ae3a4ccec9f000ca39e\");\n",
       "    }\n",
       "    const paths = {\n",
       "      \"vega\": \"https://cdn.jsdelivr.net/npm//vega@5?noext\",\n",
       "      \"vega-lib\": \"https://cdn.jsdelivr.net/npm//vega-lib?noext\",\n",
       "      \"vega-lite\": \"https://cdn.jsdelivr.net/npm//vega-lite@4.8.1?noext\",\n",
       "      \"vega-embed\": \"https://cdn.jsdelivr.net/npm//vega-embed@6?noext\",\n",
       "    };\n",
       "\n",
       "    function loadScript(lib) {\n",
       "      return new Promise(function(resolve, reject) {\n",
       "        var s = document.createElement('script');\n",
       "        s.src = paths[lib];\n",
       "        s.async = true;\n",
       "        s.onload = () => resolve(paths[lib]);\n",
       "        s.onerror = () => reject(`Error loading script: ${paths[lib]}`);\n",
       "        document.getElementsByTagName(\"head\")[0].appendChild(s);\n",
       "      });\n",
       "    }\n",
       "\n",
       "    function showError(err) {\n",
       "      outputDiv.innerHTML = `<div class=\"error\" style=\"color:red;\">${err}</div>`;\n",
       "      throw err;\n",
       "    }\n",
       "\n",
       "    function displayChart(vegaEmbed) {\n",
       "      vegaEmbed(outputDiv, spec, embedOpt)\n",
       "        .catch(err => showError(`Javascript Error: ${err.message}<br>This usually means there's a typo in your chart specification. See the javascript console for the full traceback.`));\n",
       "    }\n",
       "\n",
       "    if(typeof define === \"function\" && define.amd) {\n",
       "      requirejs.config({paths});\n",
       "      require([\"vega-embed\"], displayChart, err => showError(`Error loading script: ${err.message}`));\n",
       "    } else if (typeof vegaEmbed === \"function\") {\n",
       "      displayChart(vegaEmbed);\n",
       "    } else {\n",
       "      loadScript(\"vega\")\n",
       "        .then(() => loadScript(\"vega-lite\"))\n",
       "        .then(() => loadScript(\"vega-embed\"))\n",
       "        .catch(showError)\n",
       "        .then(() => displayChart(vegaEmbed));\n",
       "    }\n",
       "  })({\"config\": {\"view\": {\"continuousWidth\": 400, \"continuousHeight\": 300}}, \"layer\": [{\"mark\": \"line\", \"encoding\": {\"x\": {\"type\": \"temporal\", \"field\": \"day\", \"title\": \"Day\"}, \"y\": {\"type\": \"quantitative\", \"field\": \"num_prs\", \"title\": \"# PRs\"}}, \"selection\": {\"selector002\": {\"type\": \"interval\", \"bind\": \"scales\", \"encodings\": [\"x\", \"y\"]}}, \"title\": \"Merged PRs (Last 28 Days)\"}, {\"mark\": \"point\", \"encoding\": {\"x\": {\"type\": \"temporal\", \"field\": \"day\", \"title\": \"Day\"}, \"y\": {\"type\": \"quantitative\", \"field\": \"num_prs\", \"title\": \"# PRs\"}}, \"title\": \"Merged PRs (Last 28 Days)\"}], \"data\": {\"name\": \"data-47e800b15acbfa7eadc2bbef262fe9e5\"}, \"$schema\": \"https://vega.github.io/schema/vega-lite/v4.8.1.json\", \"datasets\": {\"data-47e800b15acbfa7eadc2bbef262fe9e5\": [{\"day\": \"2019-08-01T00:00:00\", \"num_prs\": 14.0}, {\"day\": \"2019-08-02T00:00:00\", \"num_prs\": 25.0}, {\"day\": \"2019-08-03T00:00:00\", \"num_prs\": 32.0}, {\"day\": \"2019-08-04T00:00:00\", \"num_prs\": 36.0}, {\"day\": \"2019-08-05T00:00:00\", \"num_prs\": 49.0}, {\"day\": \"2019-08-06T00:00:00\", \"num_prs\": 79.0}, {\"day\": \"2019-08-07T00:00:00\", \"num_prs\": 100.0}, {\"day\": \"2019-08-08T00:00:00\", \"num_prs\": 118.0}, {\"day\": \"2019-08-09T00:00:00\", \"num_prs\": 137.0}, {\"day\": \"2019-08-10T00:00:00\", \"num_prs\": 143.0}, {\"day\": \"2019-08-11T00:00:00\", \"num_prs\": 146.0}, {\"day\": \"2019-08-12T00:00:00\", \"num_prs\": 166.0}, {\"day\": \"2019-08-13T00:00:00\", \"num_prs\": 186.0}, {\"day\": \"2019-08-14T00:00:00\", \"num_prs\": 201.0}, {\"day\": \"2019-08-15T00:00:00\", \"num_prs\": 219.0}, {\"day\": \"2019-08-16T00:00:00\", \"num_prs\": 250.0}, {\"day\": \"2019-08-17T00:00:00\", \"num_prs\": 257.0}, {\"day\": \"2019-08-18T00:00:00\", \"num_prs\": 261.0}, {\"day\": \"2019-08-19T00:00:00\", \"num_prs\": 283.0}, {\"day\": \"2019-08-20T00:00:00\", \"num_prs\": 306.0}, {\"day\": \"2019-08-21T00:00:00\", \"num_prs\": 333.0}, {\"day\": \"2019-08-22T00:00:00\", \"num_prs\": 366.0}, {\"day\": \"2019-08-23T00:00:00\", \"num_prs\": 387.0}, {\"day\": \"2019-08-24T00:00:00\", \"num_prs\": 395.0}, {\"day\": \"2019-08-25T00:00:00\", \"num_prs\": 397.0}, {\"day\": \"2019-08-26T00:00:00\", \"num_prs\": 406.0}, {\"day\": \"2019-08-28T00:00:00\", \"num_prs\": 413.0}, {\"day\": \"2019-08-29T00:00:00\", \"num_prs\": 421.0}, {\"day\": \"2019-08-30T00:00:00\", \"num_prs\": 434.0}, {\"day\": \"2019-08-31T00:00:00\", \"num_prs\": 428.0}, {\"day\": \"2019-09-01T00:00:00\", \"num_prs\": 425.0}, {\"day\": \"2019-09-02T00:00:00\", \"num_prs\": 416.0}, {\"day\": \"2019-09-03T00:00:00\", \"num_prs\": 406.0}, {\"day\": \"2019-09-04T00:00:00\", \"num_prs\": 411.0}, {\"day\": \"2019-09-05T00:00:00\", \"num_prs\": 412.0}, {\"day\": \"2019-09-06T00:00:00\", \"num_prs\": 412.0}, {\"day\": \"2019-09-07T00:00:00\", \"num_prs\": 410.0}, {\"day\": \"2019-09-08T00:00:00\", \"num_prs\": 408.0}, {\"day\": \"2019-09-09T00:00:00\", \"num_prs\": 407.0}, {\"day\": \"2019-09-10T00:00:00\", \"num_prs\": 404.0}, {\"day\": \"2019-09-11T00:00:00\", \"num_prs\": 401.0}, {\"day\": \"2019-09-12T00:00:00\", \"num_prs\": 388.0}, {\"day\": \"2019-09-13T00:00:00\", \"num_prs\": 369.0}, {\"day\": \"2019-09-14T00:00:00\", \"num_prs\": 364.0}, {\"day\": \"2019-09-15T00:00:00\", \"num_prs\": 370.0}, {\"day\": \"2019-09-16T00:00:00\", \"num_prs\": 371.0}, {\"day\": \"2019-09-17T00:00:00\", \"num_prs\": 377.0}, {\"day\": \"2019-09-18T00:00:00\", \"num_prs\": 370.0}, {\"day\": \"2019-09-19T00:00:00\", \"num_prs\": 356.0}, {\"day\": \"2019-09-20T00:00:00\", \"num_prs\": 347.0}, {\"day\": \"2019-09-21T00:00:00\", \"num_prs\": 352.0}, {\"day\": \"2019-09-22T00:00:00\", \"num_prs\": 356.0}, {\"day\": \"2019-09-23T00:00:00\", \"num_prs\": 375.0}, {\"day\": \"2019-09-24T00:00:00\", \"num_prs\": 396.0}, {\"day\": \"2019-09-25T00:00:00\", \"num_prs\": 413.0}, {\"day\": \"2019-09-26T00:00:00\", \"num_prs\": 417.0}, {\"day\": \"2019-09-27T00:00:00\", \"num_prs\": 413.0}, {\"day\": \"2019-09-28T00:00:00\", \"num_prs\": 419.0}, {\"day\": \"2019-09-29T00:00:00\", \"num_prs\": 428.0}, {\"day\": \"2019-09-30T00:00:00\", \"num_prs\": 443.0}, {\"day\": \"2019-10-01T00:00:00\", \"num_prs\": 440.0}, {\"day\": \"2019-10-02T00:00:00\", \"num_prs\": 432.0}, {\"day\": \"2019-10-03T00:00:00\", \"num_prs\": 436.0}, {\"day\": \"2019-10-04T00:00:00\", \"num_prs\": 437.0}, {\"day\": \"2019-10-05T00:00:00\", \"num_prs\": 444.0}, {\"day\": \"2019-10-06T00:00:00\", \"num_prs\": 447.0}, {\"day\": \"2019-10-07T00:00:00\", \"num_prs\": 442.0}, {\"day\": \"2019-10-08T00:00:00\", \"num_prs\": 447.0}, {\"day\": \"2019-10-09T00:00:00\", \"num_prs\": 459.0}, {\"day\": \"2019-10-10T00:00:00\", \"num_prs\": 480.0}, {\"day\": \"2019-10-11T00:00:00\", \"num_prs\": 496.0}, {\"day\": \"2019-10-12T00:00:00\", \"num_prs\": 515.0}, {\"day\": \"2019-10-13T00:00:00\", \"num_prs\": 511.0}, {\"day\": \"2019-10-14T00:00:00\", \"num_prs\": 514.0}, {\"day\": \"2019-10-15T00:00:00\", \"num_prs\": 512.0}, {\"day\": \"2019-10-16T00:00:00\", \"num_prs\": 526.0}, {\"day\": \"2019-10-17T00:00:00\", \"num_prs\": 533.0}, {\"day\": \"2019-10-18T00:00:00\", \"num_prs\": 544.0}, {\"day\": \"2019-10-19T00:00:00\", \"num_prs\": 540.0}, {\"day\": \"2019-10-21T00:00:00\", \"num_prs\": 531.0}, {\"day\": \"2019-10-22T00:00:00\", \"num_prs\": 525.0}, {\"day\": \"2019-10-23T00:00:00\", \"num_prs\": 529.0}, {\"day\": \"2019-10-24T00:00:00\", \"num_prs\": 539.0}, {\"day\": \"2019-10-25T00:00:00\", \"num_prs\": 556.0}, {\"day\": \"2019-10-26T00:00:00\", \"num_prs\": 557.0}, {\"day\": \"2019-10-27T00:00:00\", \"num_prs\": 552.0}, {\"day\": \"2019-10-28T00:00:00\", \"num_prs\": 538.0}, {\"day\": \"2019-10-29T00:00:00\", \"num_prs\": 534.0}, {\"day\": \"2019-10-30T00:00:00\", \"num_prs\": 540.0}, {\"day\": \"2019-10-31T00:00:00\", \"num_prs\": 526.0}, {\"day\": \"2019-11-01T00:00:00\", \"num_prs\": 537.0}, {\"day\": \"2019-11-02T00:00:00\", \"num_prs\": 540.0}, {\"day\": \"2019-11-03T00:00:00\", \"num_prs\": 537.0}, {\"day\": \"2019-11-04T00:00:00\", \"num_prs\": 542.0}, {\"day\": \"2019-11-05T00:00:00\", \"num_prs\": 540.0}, {\"day\": \"2019-11-06T00:00:00\", \"num_prs\": 539.0}, {\"day\": \"2019-11-07T00:00:00\", \"num_prs\": 535.0}, {\"day\": \"2019-11-08T00:00:00\", \"num_prs\": 533.0}, {\"day\": \"2019-11-09T00:00:00\", \"num_prs\": 518.0}, {\"day\": \"2019-11-10T00:00:00\", \"num_prs\": 514.0}, {\"day\": \"2019-11-11T00:00:00\", \"num_prs\": 498.0}, {\"day\": \"2019-11-12T00:00:00\", \"num_prs\": 483.0}, {\"day\": \"2019-11-13T00:00:00\", \"num_prs\": 461.0}, {\"day\": \"2019-11-14T00:00:00\", \"num_prs\": 469.0}, {\"day\": \"2019-11-15T00:00:00\", \"num_prs\": 455.0}, {\"day\": \"2019-11-16T00:00:00\", \"num_prs\": 450.0}, {\"day\": \"2019-11-18T00:00:00\", \"num_prs\": 434.0}, {\"day\": \"2019-11-19T00:00:00\", \"num_prs\": 424.0}, {\"day\": \"2019-11-20T00:00:00\", \"num_prs\": 401.0}, {\"day\": \"2019-11-21T00:00:00\", \"num_prs\": 371.0}, {\"day\": \"2019-11-22T00:00:00\", \"num_prs\": 346.0}, {\"day\": \"2019-11-23T00:00:00\", \"num_prs\": 341.0}, {\"day\": \"2019-11-24T00:00:00\", \"num_prs\": 337.0}, {\"day\": \"2019-11-25T00:00:00\", \"num_prs\": 344.0}, {\"day\": \"2019-11-26T00:00:00\", \"num_prs\": 350.0}, {\"day\": \"2019-11-27T00:00:00\", \"num_prs\": 338.0}, {\"day\": \"2019-11-28T00:00:00\", \"num_prs\": 338.0}, {\"day\": \"2019-11-29T00:00:00\", \"num_prs\": 310.0}, {\"day\": \"2019-12-01T00:00:00\", \"num_prs\": 296.0}, {\"day\": \"2019-12-02T00:00:00\", \"num_prs\": 286.0}, {\"day\": \"2019-12-03T00:00:00\", \"num_prs\": 281.0}, {\"day\": \"2019-12-04T00:00:00\", \"num_prs\": 273.0}, {\"day\": \"2019-12-05T00:00:00\", \"num_prs\": 266.0}, {\"day\": \"2019-12-06T00:00:00\", \"num_prs\": 254.0}, {\"day\": \"2019-12-07T00:00:00\", \"num_prs\": 253.0}, {\"day\": \"2019-12-08T00:00:00\", \"num_prs\": 254.0}, {\"day\": \"2019-12-09T00:00:00\", \"num_prs\": 252.0}, {\"day\": \"2019-12-10T00:00:00\", \"num_prs\": 257.0}, {\"day\": \"2019-12-11T00:00:00\", \"num_prs\": 261.0}, {\"day\": \"2019-12-12T00:00:00\", \"num_prs\": 248.0}, {\"day\": \"2019-12-13T00:00:00\", \"num_prs\": 248.0}, {\"day\": \"2019-12-16T00:00:00\", \"num_prs\": 252.0}, {\"day\": \"2019-12-17T00:00:00\", \"num_prs\": 263.0}, {\"day\": \"2019-12-18T00:00:00\", \"num_prs\": 281.0}, {\"day\": \"2019-12-19T00:00:00\", \"num_prs\": 284.0}, {\"day\": \"2019-12-20T00:00:00\", \"num_prs\": 280.0}, {\"day\": \"2019-12-21T00:00:00\", \"num_prs\": 280.0}, {\"day\": \"2019-12-23T00:00:00\", \"num_prs\": 273.0}, {\"day\": \"2019-12-24T00:00:00\", \"num_prs\": 263.0}, {\"day\": \"2019-12-25T00:00:00\", \"num_prs\": 253.0}, {\"day\": \"2019-12-26T00:00:00\", \"num_prs\": 245.0}, {\"day\": \"2019-12-27T00:00:00\", \"num_prs\": 251.0}, {\"day\": \"2019-12-28T00:00:00\", \"num_prs\": 253.0}, {\"day\": \"2019-12-29T00:00:00\", \"num_prs\": 253.0}, {\"day\": \"2019-12-30T00:00:00\", \"num_prs\": 249.0}, {\"day\": \"2019-12-31T00:00:00\", \"num_prs\": 241.0}, {\"day\": \"2020-01-01T00:00:00\", \"num_prs\": 228.0}, {\"day\": \"2020-01-02T00:00:00\", \"num_prs\": 221.0}, {\"day\": \"2020-01-03T00:00:00\", \"num_prs\": 218.0}, {\"day\": \"2020-01-04T00:00:00\", \"num_prs\": 218.0}, {\"day\": \"2020-01-05T00:00:00\", \"num_prs\": 218.0}, {\"day\": \"2020-01-06T00:00:00\", \"num_prs\": 224.0}, {\"day\": \"2020-01-07T00:00:00\", \"num_prs\": 228.0}, {\"day\": \"2020-01-08T00:00:00\", \"num_prs\": 231.0}, {\"day\": \"2020-01-09T00:00:00\", \"num_prs\": 226.0}, {\"day\": \"2020-01-10T00:00:00\", \"num_prs\": 228.0}, {\"day\": \"2020-01-11T00:00:00\", \"num_prs\": 230.0}, {\"day\": \"2020-01-12T00:00:00\", \"num_prs\": 231.0}, {\"day\": \"2020-01-13T00:00:00\", \"num_prs\": 227.0}, {\"day\": \"2020-01-14T00:00:00\", \"num_prs\": 229.0}, {\"day\": \"2020-01-15T00:00:00\", \"num_prs\": 223.0}, {\"day\": \"2020-01-16T00:00:00\", \"num_prs\": 233.0}, {\"day\": \"2020-01-17T00:00:00\", \"num_prs\": 238.0}, {\"day\": \"2020-01-18T00:00:00\", \"num_prs\": 241.0}, {\"day\": \"2020-01-19T00:00:00\", \"num_prs\": 246.0}, {\"day\": \"2020-01-20T00:00:00\", \"num_prs\": 252.0}, {\"day\": \"2020-01-21T00:00:00\", \"num_prs\": 260.0}, {\"day\": \"2020-01-22T00:00:00\", \"num_prs\": 279.0}, {\"day\": \"2020-01-23T00:00:00\", \"num_prs\": 289.0}, {\"day\": \"2020-01-24T00:00:00\", \"num_prs\": 295.0}, {\"day\": \"2020-01-25T00:00:00\", \"num_prs\": 297.0}, {\"day\": \"2020-01-26T00:00:00\", \"num_prs\": 303.0}, {\"day\": \"2020-01-27T00:00:00\", \"num_prs\": 308.0}, {\"day\": \"2020-01-28T00:00:00\", \"num_prs\": 325.0}, {\"day\": \"2020-01-29T00:00:00\", \"num_prs\": 342.0}, {\"day\": \"2020-01-30T00:00:00\", \"num_prs\": 354.0}, {\"day\": \"2020-01-31T00:00:00\", \"num_prs\": 368.0}, {\"day\": \"2020-02-01T00:00:00\", \"num_prs\": 383.0}, {\"day\": \"2020-02-02T00:00:00\", \"num_prs\": 383.0}, {\"day\": \"2020-02-03T00:00:00\", \"num_prs\": 390.0}, {\"day\": \"2020-02-04T00:00:00\", \"num_prs\": 400.0}, {\"day\": \"2020-02-05T00:00:00\", \"num_prs\": 422.0}, {\"day\": \"2020-02-06T00:00:00\", \"num_prs\": 420.0}, {\"day\": \"2020-02-07T00:00:00\", \"num_prs\": 431.0}, {\"day\": \"2020-02-08T00:00:00\", \"num_prs\": 434.0}, {\"day\": \"2020-02-09T00:00:00\", \"num_prs\": 436.0}, {\"day\": \"2020-02-10T00:00:00\", \"num_prs\": 445.0}, {\"day\": \"2020-02-11T00:00:00\", \"num_prs\": 451.0}, {\"day\": \"2020-02-12T00:00:00\", \"num_prs\": 478.0}, {\"day\": \"2020-02-13T00:00:00\", \"num_prs\": 477.0}, {\"day\": \"2020-02-14T00:00:00\", \"num_prs\": 487.0}, {\"day\": \"2020-02-15T00:00:00\", \"num_prs\": 492.0}, {\"day\": \"2020-02-16T00:00:00\", \"num_prs\": 491.0}, {\"day\": \"2020-02-17T00:00:00\", \"num_prs\": 485.0}, {\"day\": \"2020-02-18T00:00:00\", \"num_prs\": 482.0}, {\"day\": \"2020-02-19T00:00:00\", \"num_prs\": 496.0}, {\"day\": \"2020-02-20T00:00:00\", \"num_prs\": 498.0}, {\"day\": \"2020-02-21T00:00:00\", \"num_prs\": 504.0}, {\"day\": \"2020-02-22T00:00:00\", \"num_prs\": 505.0}, {\"day\": \"2020-02-23T00:00:00\", \"num_prs\": 502.0}, {\"day\": \"2020-02-24T00:00:00\", \"num_prs\": 513.0}, {\"day\": \"2020-02-25T00:00:00\", \"num_prs\": 509.0}, {\"day\": \"2020-02-26T00:00:00\", \"num_prs\": 512.0}, {\"day\": \"2020-02-27T00:00:00\", \"num_prs\": 509.0}, {\"day\": \"2020-02-28T00:00:00\", \"num_prs\": 495.0}, {\"day\": \"2020-02-29T00:00:00\", \"num_prs\": 477.0}, {\"day\": \"2020-03-01T00:00:00\", \"num_prs\": 475.0}, {\"day\": \"2020-03-02T00:00:00\", \"num_prs\": 460.0}, {\"day\": \"2020-03-03T00:00:00\", \"num_prs\": 442.0}, {\"day\": \"2020-03-04T00:00:00\", \"num_prs\": 426.0}, {\"day\": \"2020-03-05T00:00:00\", \"num_prs\": 422.0}, {\"day\": \"2020-03-06T00:00:00\", \"num_prs\": 410.0}, {\"day\": \"2020-03-07T00:00:00\", \"num_prs\": 409.0}, {\"day\": \"2020-03-08T00:00:00\", \"num_prs\": 407.0}, {\"day\": \"2020-03-09T00:00:00\", \"num_prs\": 405.0}, {\"day\": \"2020-03-10T00:00:00\", \"num_prs\": 393.0}, {\"day\": \"2020-03-11T00:00:00\", \"num_prs\": 366.0}, {\"day\": \"2020-03-12T00:00:00\", \"num_prs\": 366.0}, {\"day\": \"2020-03-13T00:00:00\", \"num_prs\": 356.0}, {\"day\": \"2020-03-14T00:00:00\", \"num_prs\": 351.0}, {\"day\": \"2020-03-15T00:00:00\", \"num_prs\": 350.0}, {\"day\": \"2020-03-16T00:00:00\", \"num_prs\": 358.0}, {\"day\": \"2020-03-17T00:00:00\", \"num_prs\": 359.0}, {\"day\": \"2020-03-18T00:00:00\", \"num_prs\": 338.0}, {\"day\": \"2020-03-19T00:00:00\", \"num_prs\": 337.0}, {\"day\": \"2020-03-20T00:00:00\", \"num_prs\": 331.0}, {\"day\": \"2020-03-21T00:00:00\", \"num_prs\": 331.0}, {\"day\": \"2020-03-22T00:00:00\", \"num_prs\": 331.0}, {\"day\": \"2020-03-23T00:00:00\", \"num_prs\": 330.0}, {\"day\": \"2020-03-24T00:00:00\", \"num_prs\": 338.0}, {\"day\": \"2020-03-25T00:00:00\", \"num_prs\": 332.0}, {\"day\": \"2020-03-26T00:00:00\", \"num_prs\": 335.0}, {\"day\": \"2020-03-27T00:00:00\", \"num_prs\": 338.0}, {\"day\": \"2020-03-28T00:00:00\", \"num_prs\": 339.0}, {\"day\": \"2020-03-30T00:00:00\", \"num_prs\": 341.0}, {\"day\": \"2020-03-31T00:00:00\", \"num_prs\": 340.0}, {\"day\": \"2020-04-01T00:00:00\", \"num_prs\": 329.0}, {\"day\": \"2020-04-02T00:00:00\", \"num_prs\": 331.0}, {\"day\": \"2020-04-03T00:00:00\", \"num_prs\": 342.0}, {\"day\": \"2020-04-04T00:00:00\", \"num_prs\": 342.0}, {\"day\": \"2020-04-05T00:00:00\", \"num_prs\": 342.0}, {\"day\": \"2020-04-06T00:00:00\", \"num_prs\": 329.0}, {\"day\": \"2020-04-07T00:00:00\", \"num_prs\": 339.0}, {\"day\": \"2020-04-08T00:00:00\", \"num_prs\": 337.0}, {\"day\": \"2020-04-09T00:00:00\", \"num_prs\": 336.0}, {\"day\": \"2020-04-10T00:00:00\", \"num_prs\": 343.0}, {\"day\": \"2020-04-11T00:00:00\", \"num_prs\": 343.0}, {\"day\": \"2020-04-12T00:00:00\", \"num_prs\": 342.0}, {\"day\": \"2020-04-13T00:00:00\", \"num_prs\": 349.0}, {\"day\": \"2020-04-14T00:00:00\", \"num_prs\": 362.0}, {\"day\": \"2020-04-15T00:00:00\", \"num_prs\": 368.0}, {\"day\": \"2020-04-16T00:00:00\", \"num_prs\": 370.0}, {\"day\": \"2020-04-17T00:00:00\", \"num_prs\": 377.0}, {\"day\": \"2020-04-18T00:00:00\", \"num_prs\": 375.0}, {\"day\": \"2020-04-19T00:00:00\", \"num_prs\": 374.0}, {\"day\": \"2020-04-20T00:00:00\", \"num_prs\": 368.0}, {\"day\": \"2020-04-21T00:00:00\", \"num_prs\": 354.0}, {\"day\": \"2020-04-22T00:00:00\", \"num_prs\": 357.0}, {\"day\": \"2020-04-23T00:00:00\", \"num_prs\": 357.0}, {\"day\": \"2020-04-24T00:00:00\", \"num_prs\": 355.0}, {\"day\": \"2020-04-25T00:00:00\", \"num_prs\": 359.0}, {\"day\": \"2020-04-26T00:00:00\", \"num_prs\": 364.0}, {\"day\": \"2020-04-27T00:00:00\", \"num_prs\": 367.0}, {\"day\": \"2020-04-28T00:00:00\", \"num_prs\": 365.0}, {\"day\": \"2020-04-29T00:00:00\", \"num_prs\": 368.0}, {\"day\": \"2020-04-30T00:00:00\", \"num_prs\": 381.0}, {\"day\": \"2020-05-01T00:00:00\", \"num_prs\": 378.0}, {\"day\": \"2020-05-02T00:00:00\", \"num_prs\": 377.0}, {\"day\": \"2020-05-03T00:00:00\", \"num_prs\": 377.0}, {\"day\": \"2020-05-04T00:00:00\", \"num_prs\": 373.0}, {\"day\": \"2020-05-05T00:00:00\", \"num_prs\": 367.0}, {\"day\": \"2020-05-06T00:00:00\", \"num_prs\": 373.0}, {\"day\": \"2020-05-07T00:00:00\", \"num_prs\": 373.0}, {\"day\": \"2020-05-08T00:00:00\", \"num_prs\": 369.0}, {\"day\": \"2020-05-09T00:00:00\", \"num_prs\": 373.0}, {\"day\": \"2020-05-10T00:00:00\", \"num_prs\": 374.0}, {\"day\": \"2020-05-11T00:00:00\", \"num_prs\": 361.0}, {\"day\": \"2020-05-12T00:00:00\", \"num_prs\": 349.0}, {\"day\": \"2020-05-13T00:00:00\", \"num_prs\": 350.0}, {\"day\": \"2020-05-14T00:00:00\", \"num_prs\": 353.0}, {\"day\": \"2020-05-15T00:00:00\", \"num_prs\": 349.0}, {\"day\": \"2020-05-16T00:00:00\", \"num_prs\": 348.0}, {\"day\": \"2020-05-17T00:00:00\", \"num_prs\": 347.0}, {\"day\": \"2020-05-18T00:00:00\", \"num_prs\": 343.0}, {\"day\": \"2020-05-19T00:00:00\", \"num_prs\": 343.0}, {\"day\": \"2020-05-20T00:00:00\", \"num_prs\": 349.0}, {\"day\": \"2020-05-21T00:00:00\", \"num_prs\": 339.0}, {\"day\": \"2020-05-22T00:00:00\", \"num_prs\": 338.0}, {\"day\": \"2020-05-23T00:00:00\", \"num_prs\": 335.0}, {\"day\": \"2020-05-24T00:00:00\", \"num_prs\": 336.0}, {\"day\": \"2020-05-25T00:00:00\", \"num_prs\": 325.0}, {\"day\": \"2020-05-26T00:00:00\", \"num_prs\": 330.0}, {\"day\": \"2020-05-27T00:00:00\", \"num_prs\": 328.0}, {\"day\": \"2020-05-28T00:00:00\", \"num_prs\": 308.0}, {\"day\": \"2020-05-29T00:00:00\", \"num_prs\": 306.0}, {\"day\": \"2020-05-30T00:00:00\", \"num_prs\": 305.0}, {\"day\": \"2020-05-31T00:00:00\", \"num_prs\": 305.0}, {\"day\": \"2020-06-01T00:00:00\", \"num_prs\": 313.0}, {\"day\": \"2020-06-02T00:00:00\", \"num_prs\": 308.0}, {\"day\": \"2020-06-03T00:00:00\", \"num_prs\": 299.0}, {\"day\": \"2020-06-04T00:00:00\", \"num_prs\": 298.0}, {\"day\": \"2020-06-05T00:00:00\", \"num_prs\": 295.0}, {\"day\": \"2020-06-06T00:00:00\", \"num_prs\": 289.0}, {\"day\": \"2020-06-07T00:00:00\", \"num_prs\": 288.0}, {\"day\": \"2020-06-08T00:00:00\", \"num_prs\": 289.0}, {\"day\": \"2020-06-09T00:00:00\", \"num_prs\": 295.0}, {\"day\": \"2020-06-10T00:00:00\", \"num_prs\": 282.0}, {\"day\": \"2020-06-11T00:00:00\", \"num_prs\": 279.0}, {\"day\": \"2020-06-12T00:00:00\", \"num_prs\": 275.0}, {\"day\": \"2020-06-13T00:00:00\", \"num_prs\": 276.0}, {\"day\": \"2020-06-14T00:00:00\", \"num_prs\": 275.0}, {\"day\": \"2020-06-15T00:00:00\", \"num_prs\": 282.0}, {\"day\": \"2020-06-16T00:00:00\", \"num_prs\": 285.0}, {\"day\": \"2020-06-17T00:00:00\", \"num_prs\": 288.0}, {\"day\": \"2020-06-18T00:00:00\", \"num_prs\": 301.0}, {\"day\": \"2020-06-19T00:00:00\", \"num_prs\": 315.0}, {\"day\": \"2020-06-20T00:00:00\", \"num_prs\": 319.0}, {\"day\": \"2020-06-21T00:00:00\", \"num_prs\": 314.0}, {\"day\": \"2020-06-22T00:00:00\", \"num_prs\": 332.0}, {\"day\": \"2020-06-23T00:00:00\", \"num_prs\": 344.0}, {\"day\": \"2020-06-24T00:00:00\", \"num_prs\": 349.0}, {\"day\": \"2020-06-25T00:00:00\", \"num_prs\": 355.0}, {\"day\": \"2020-06-26T00:00:00\", \"num_prs\": 358.0}, {\"day\": \"2020-06-27T00:00:00\", \"num_prs\": 361.0}, {\"day\": \"2020-06-28T00:00:00\", \"num_prs\": 368.0}, {\"day\": \"2020-06-29T00:00:00\", \"num_prs\": 375.0}, {\"day\": \"2020-06-30T00:00:00\", \"num_prs\": 383.0}, {\"day\": \"2020-07-01T00:00:00\", \"num_prs\": 381.0}, {\"day\": \"2020-07-02T00:00:00\", \"num_prs\": 382.0}, {\"day\": \"2020-07-03T00:00:00\", \"num_prs\": 377.0}, {\"day\": \"2020-07-04T00:00:00\", \"num_prs\": 380.0}, {\"day\": \"2020-07-05T00:00:00\", \"num_prs\": 381.0}, {\"day\": \"2020-07-06T00:00:00\", \"num_prs\": 390.0}, {\"day\": \"2020-07-07T00:00:00\", \"num_prs\": 398.0}, {\"day\": \"2020-07-08T00:00:00\", \"num_prs\": 409.0}, {\"day\": \"2020-07-09T00:00:00\", \"num_prs\": 411.0}, {\"day\": \"2020-07-10T00:00:00\", \"num_prs\": 420.0}, {\"day\": \"2020-07-11T00:00:00\", \"num_prs\": 422.0}, {\"day\": \"2020-07-12T00:00:00\", \"num_prs\": 426.0}, {\"day\": \"2020-07-13T00:00:00\", \"num_prs\": 418.0}, {\"day\": \"2020-07-14T00:00:00\", \"num_prs\": 416.0}, {\"day\": \"2020-07-15T00:00:00\", \"num_prs\": 405.0}, {\"day\": \"2020-07-16T00:00:00\", \"num_prs\": 397.0}, {\"day\": \"2020-07-17T00:00:00\", \"num_prs\": 389.0}, {\"day\": \"2020-07-18T00:00:00\", \"num_prs\": 384.0}, {\"day\": \"2020-07-20T00:00:00\", \"num_prs\": 382.0}, {\"day\": \"2020-07-21T00:00:00\", \"num_prs\": 376.0}, {\"day\": \"2020-07-22T00:00:00\", \"num_prs\": 379.0}, {\"day\": \"2020-07-23T00:00:00\", \"num_prs\": 384.0}, {\"day\": \"2020-07-24T00:00:00\", \"num_prs\": 380.0}]}}, {\"mode\": \"vega-lite\"});\n",
       "</script>"
      ],
      "text/plain": [
       "alt.LayerChart(...)"
      ]
     },
     "execution_count": 12,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "chart = alt.Chart(prs_df, title= \"Merged PRs (Last 28 Days)\")\n",
    "line = chart.mark_line().encode(\n",
    "  x= alt.X('day', title = \"Day\"),\n",
    "  y=alt.Y(\"num_prs\", title=\"# PRs\"),    \n",
    ")\n",
    "\n",
    "point = line + line.mark_point()\n",
    "point.interactive()"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Release stats per release (quarter)\n",
    "\n",
    "* Compute stats about a release \n",
    "* We do this based on time\n",
    "* You can see a sample of the payload at [https://api.github.com/repos/kubeflow/pipelines/pulls/1038](https://api.github.com/repos/kubeflow/pipelines/pulls/1038)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 13,
   "metadata": {},
   "outputs": [
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "Downloading: 100%|██████████| 1811/1811 [00:00<00:00, 3621.00rows/s]\n"
     ]
    }
   ],
   "source": [
    "release_months = []\n",
    "year = 2019\n",
    "\n",
    "\n",
    "for month in range(8, 11):\n",
    "    release_months.append(\"\\\"{0}{1:02}\\\"\".format(year, month))\n",
    "        \n",
    "\n",
    "query = \"\"\"\n",
    "SELECT\n",
    "    DATE(created_at) AS pr_date,\n",
    "    actor.id,\n",
    "    actor.login,\n",
    "    JSON_EXTRACT(payload, '$.pull_request.merged') as merged,\n",
    "    JSON_EXTRACT(payload, '$.pull_request.id') as pr_id,\n",
    "    JSON_EXTRACT(payload, '$.pull_request.url') as pr_url,\n",
    "    JSON_EXTRACT(payload, '$.pull_request.user.id') as user_id\n",
    "  FROM `githubarchive.month.*`\n",
    "  WHERE\n",
    "    _TABLE_SUFFIX IN ({0})\n",
    "    AND type = 'PullRequestEvent'\n",
    "    AND org.login = 'kubeflow'\n",
    "    AND JSON_EXTRACT(payload, '$.action') IN ('\"closed\"')\n",
    "\"\"\".format(\",\".join(release_months))\n",
    "\n",
    "prs=gbq.read_gbq(str(query), dialect='standard', project_id=PROJECT)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 14,
   "metadata": {},
   "outputs": [],
   "source": [
    "# Filter PRs to merged PRs\n",
    "v=prs[\"merged\"].values == 'true'\n",
    "merged_prs = prs.iloc[v]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 15,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Number of unique pr authors (merged & unmerged) (190,)\n",
      "Number of unique prs (merged & unmerged) (1788,)\n",
      "Number of unique pr authors (merged) (155,)\n",
      "Number of unique prs (merged) (1492,)\n"
     ]
    }
   ],
   "source": [
    "unique_pr_logins = prs[\"user_id\"].unique()\n",
    "unique_prs = prs[\"pr_id\"].unique()\n",
    "\n",
    "merged_unique_logins = merged_prs[\"user_id\"].unique()\n",
    "merged_unique_prs = merged_prs[\"pr_id\"].unique()\n",
    "print(\"Number of unique pr authors (merged & unmerged) {0}\".format(unique_pr_logins.shape))\n",
    "print(\"Number of unique prs (merged & unmerged) {0}\".format(unique_prs.shape))\n",
    "print(\"Number of unique pr authors (merged) {0}\".format(merged_unique_logins.shape))\n",
    "print(\"Number of unique prs (merged) {0}\".format(merged_unique_prs.shape))"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Get a list of distinct actions\n",
    "\n",
    "* Here's a list of events in the [api](https://developer.github.com/v4/union/pullrequesttimelineitems/)\n",
    "* It looks like these are different from the ones in the github archive"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 16,
   "metadata": {},
   "outputs": [
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "Downloading: 100%|██████████| 8/8 [00:00<00:00, 32.50rows/s]\n"
     ]
    }
   ],
   "source": [
    "query = \"\"\"\n",
    "SELECT\n",
    "    distinct JSON_EXTRACT(payload, '$.action')\n",
    "  FROM `githubarchive.month.*`\n",
    "  WHERE\n",
    "    _TABLE_SUFFIX IN ({0})    \n",
    "\"\"\".format(\",\".join(months))\n",
    "\n",
    "actions=gbq.read_gbq(str(query), dialect='standard', project_id=PROJECT)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 17,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>f0_</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>\"opened\"</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>None</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>\"published\"</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>\"created\"</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>\"added\"</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>5</th>\n",
       "      <td>\"started\"</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>6</th>\n",
       "      <td>\"reopened\"</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>7</th>\n",
       "      <td>\"closed\"</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "           f0_\n",
       "0     \"opened\"\n",
       "1         None\n",
       "2  \"published\"\n",
       "3    \"created\"\n",
       "4      \"added\"\n",
       "5    \"started\"\n",
       "6   \"reopened\"\n",
       "7     \"closed\""
      ]
     },
     "execution_count": 17,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "actions"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## New Issues Last 28 Days"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 18,
   "metadata": {},
   "outputs": [
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "Downloading: 100%|██████████| 4082/4082 [00:00<00:00, 7773.58rows/s]\n"
     ]
    }
   ],
   "source": [
    "query = \"\"\"\n",
    "SELECT\n",
    "    DATE(created_at) AS issue_date,\n",
    "    actor.id,\n",
    "    actor.login,\n",
    "    JSON_EXTRACT(payload, '$.pull_request.id') as issue_id,\n",
    "    JSON_EXTRACT(payload, '$.pull_request.url') as issue_url  \n",
    "  FROM `githubarchive.month.*`\n",
    "  WHERE\n",
    "    _TABLE_SUFFIX IN ({0})\n",
    "    AND type = 'IssuesEvent'\n",
    "    AND org.login = 'kubeflow'\n",
    "    AND JSON_EXTRACT(payload, '$.action') IN ('\"opened\"')\n",
    "\"\"\".format(\",\".join(months))\n",
    "\n",
    "issues=gbq.read_gbq(str(query), dialect='standard', project_id=PROJECT)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 19,
   "metadata": {},
   "outputs": [],
   "source": [
    "issue_counts=issues[\"issue_date\"].value_counts()\n",
    "issue_counts=issue_counts.sort_index()\n",
    "rolling_issue_count = issue_counts.rolling('28d').sum()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 24,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "\n",
       "<div id=\"altair-viz-fde6b54cc50c499696ca23c3c6554f37\"></div>\n",
       "<script type=\"text/javascript\">\n",
       "  (function(spec, embedOpt){\n",
       "    let outputDiv = document.currentScript.previousElementSibling;\n",
       "    if (outputDiv.id !== \"altair-viz-fde6b54cc50c499696ca23c3c6554f37\") {\n",
       "      outputDiv = document.getElementById(\"altair-viz-fde6b54cc50c499696ca23c3c6554f37\");\n",
       "    }\n",
       "    const paths = {\n",
       "      \"vega\": \"https://cdn.jsdelivr.net/npm//vega@5?noext\",\n",
       "      \"vega-lib\": \"https://cdn.jsdelivr.net/npm//vega-lib?noext\",\n",
       "      \"vega-lite\": \"https://cdn.jsdelivr.net/npm//vega-lite@4.8.1?noext\",\n",
       "      \"vega-embed\": \"https://cdn.jsdelivr.net/npm//vega-embed@6?noext\",\n",
       "    };\n",
       "\n",
       "    function loadScript(lib) {\n",
       "      return new Promise(function(resolve, reject) {\n",
       "        var s = document.createElement('script');\n",
       "        s.src = paths[lib];\n",
       "        s.async = true;\n",
       "        s.onload = () => resolve(paths[lib]);\n",
       "        s.onerror = () => reject(`Error loading script: ${paths[lib]}`);\n",
       "        document.getElementsByTagName(\"head\")[0].appendChild(s);\n",
       "      });\n",
       "    }\n",
       "\n",
       "    function showError(err) {\n",
       "      outputDiv.innerHTML = `<div class=\"error\" style=\"color:red;\">${err}</div>`;\n",
       "      throw err;\n",
       "    }\n",
       "\n",
       "    function displayChart(vegaEmbed) {\n",
       "      vegaEmbed(outputDiv, spec, embedOpt)\n",
       "        .catch(err => showError(`Javascript Error: ${err.message}<br>This usually means there's a typo in your chart specification. See the javascript console for the full traceback.`));\n",
       "    }\n",
       "\n",
       "    if(typeof define === \"function\" && define.amd) {\n",
       "      requirejs.config({paths});\n",
       "      require([\"vega-embed\"], displayChart, err => showError(`Error loading script: ${err.message}`));\n",
       "    } else if (typeof vegaEmbed === \"function\") {\n",
       "      displayChart(vegaEmbed);\n",
       "    } else {\n",
       "      loadScript(\"vega\")\n",
       "        .then(() => loadScript(\"vega-lite\"))\n",
       "        .then(() => loadScript(\"vega-embed\"))\n",
       "        .catch(showError)\n",
       "        .then(() => displayChart(vegaEmbed));\n",
       "    }\n",
       "  })({\"config\": {\"view\": {\"continuousWidth\": 400, \"continuousHeight\": 300}}, \"layer\": [{\"mark\": \"line\", \"encoding\": {\"x\": {\"type\": \"temporal\", \"field\": \"day\", \"title\": \"Day\"}, \"y\": {\"type\": \"quantitative\", \"field\": \"num_issues\", \"title\": \"# issues\"}}, \"selection\": {\"selector004\": {\"type\": \"interval\", \"bind\": \"scales\", \"encodings\": [\"x\", \"y\"]}}, \"title\": \"New Issues (Last 28 Days)\"}, {\"mark\": \"point\", \"encoding\": {\"x\": {\"type\": \"temporal\", \"field\": \"day\", \"title\": \"Day\"}, \"y\": {\"type\": \"quantitative\", \"field\": \"num_issues\", \"title\": \"# issues\"}}, \"title\": \"New Issues (Last 28 Days)\"}], \"data\": {\"name\": \"data-9604b231761170bc85028cebe2dc0e13\"}, \"$schema\": \"https://vega.github.io/schema/vega-lite/v4.8.1.json\", \"datasets\": {\"data-9604b231761170bc85028cebe2dc0e13\": [{\"day\": \"2019-08-29T00:00:00\", \"num_issues\": 339.0}, {\"day\": \"2019-08-30T00:00:00\", \"num_issues\": 342.0}, {\"day\": \"2019-08-31T00:00:00\", \"num_issues\": 341.0}, {\"day\": \"2019-09-01T00:00:00\", \"num_issues\": 342.0}, {\"day\": \"2019-09-02T00:00:00\", \"num_issues\": 325.0}, {\"day\": \"2019-09-03T00:00:00\", \"num_issues\": 323.0}, {\"day\": \"2019-09-04T00:00:00\", \"num_issues\": 336.0}, {\"day\": \"2019-09-05T00:00:00\", \"num_issues\": 338.0}, {\"day\": \"2019-09-06T00:00:00\", \"num_issues\": 326.0}, {\"day\": \"2019-09-07T00:00:00\", \"num_issues\": 323.0}, {\"day\": \"2019-09-08T00:00:00\", \"num_issues\": 325.0}, {\"day\": \"2019-09-09T00:00:00\", \"num_issues\": 324.0}, {\"day\": \"2019-09-10T00:00:00\", \"num_issues\": 305.0}, {\"day\": \"2019-09-11T00:00:00\", \"num_issues\": 306.0}, {\"day\": \"2019-09-12T00:00:00\", \"num_issues\": 295.0}, {\"day\": \"2019-09-13T00:00:00\", \"num_issues\": 284.0}, {\"day\": \"2019-09-14T00:00:00\", \"num_issues\": 285.0}, {\"day\": \"2019-09-15T00:00:00\", \"num_issues\": 284.0}, {\"day\": \"2019-09-16T00:00:00\", \"num_issues\": 277.0}, {\"day\": \"2019-09-17T00:00:00\", \"num_issues\": 280.0}, {\"day\": \"2019-09-18T00:00:00\", \"num_issues\": 278.0}, {\"day\": \"2019-09-19T00:00:00\", \"num_issues\": 280.0}, {\"day\": \"2019-09-20T00:00:00\", \"num_issues\": 285.0}, {\"day\": \"2019-09-21T00:00:00\", \"num_issues\": 281.0}, {\"day\": \"2019-09-22T00:00:00\", \"num_issues\": 278.0}, {\"day\": \"2019-09-23T00:00:00\", \"num_issues\": 285.0}, {\"day\": \"2019-09-24T00:00:00\", \"num_issues\": 290.0}, {\"day\": \"2019-09-25T00:00:00\", \"num_issues\": 306.0}, {\"day\": \"2019-09-26T00:00:00\", \"num_issues\": 307.0}, {\"day\": \"2019-09-27T00:00:00\", \"num_issues\": 319.0}, {\"day\": \"2019-09-28T00:00:00\", \"num_issues\": 322.0}, {\"day\": \"2019-09-29T00:00:00\", \"num_issues\": 322.0}, {\"day\": \"2019-09-30T00:00:00\", \"num_issues\": 328.0}, {\"day\": \"2019-10-01T00:00:00\", \"num_issues\": 322.0}, {\"day\": \"2019-10-02T00:00:00\", \"num_issues\": 293.0}, {\"day\": \"2019-10-03T00:00:00\", \"num_issues\": 292.0}, {\"day\": \"2019-10-04T00:00:00\", \"num_issues\": 305.0}, {\"day\": \"2019-10-06T00:00:00\", \"num_issues\": 314.0}, {\"day\": \"2019-10-07T00:00:00\", \"num_issues\": 316.0}, {\"day\": \"2019-10-08T00:00:00\", \"num_issues\": 326.0}, {\"day\": \"2019-10-09T00:00:00\", \"num_issues\": 335.0}, {\"day\": \"2019-10-10T00:00:00\", \"num_issues\": 364.0}, {\"day\": \"2019-10-11T00:00:00\", \"num_issues\": 374.0}, {\"day\": \"2019-10-12T00:00:00\", \"num_issues\": 378.0}, {\"day\": \"2019-10-13T00:00:00\", \"num_issues\": 377.0}, {\"day\": \"2019-10-14T00:00:00\", \"num_issues\": 385.0}, {\"day\": \"2019-10-15T00:00:00\", \"num_issues\": 395.0}, {\"day\": \"2019-10-16T00:00:00\", \"num_issues\": 406.0}, {\"day\": \"2019-10-17T00:00:00\", \"num_issues\": 414.0}, {\"day\": \"2019-10-18T00:00:00\", \"num_issues\": 413.0}, {\"day\": \"2019-10-19T00:00:00\", \"num_issues\": 412.0}, {\"day\": \"2019-10-20T00:00:00\", \"num_issues\": 417.0}, {\"day\": \"2019-10-21T00:00:00\", \"num_issues\": 411.0}, {\"day\": \"2019-10-22T00:00:00\", \"num_issues\": 413.0}, {\"day\": \"2019-10-23T00:00:00\", \"num_issues\": 417.0}, {\"day\": \"2019-10-24T00:00:00\", \"num_issues\": 425.0}, {\"day\": \"2019-10-25T00:00:00\", \"num_issues\": 426.0}, {\"day\": \"2019-10-26T00:00:00\", \"num_issues\": 425.0}, {\"day\": \"2019-10-27T00:00:00\", \"num_issues\": 422.0}, {\"day\": \"2019-10-28T00:00:00\", \"num_issues\": 427.0}, {\"day\": \"2019-10-29T00:00:00\", \"num_issues\": 435.0}, {\"day\": \"2019-10-30T00:00:00\", \"num_issues\": 440.0}, {\"day\": \"2019-10-31T00:00:00\", \"num_issues\": 444.0}, {\"day\": \"2019-11-01T00:00:00\", \"num_issues\": 435.0}, {\"day\": \"2019-11-02T00:00:00\", \"num_issues\": 442.0}, {\"day\": \"2019-11-04T00:00:00\", \"num_issues\": 422.0}, {\"day\": \"2019-11-05T00:00:00\", \"num_issues\": 413.0}, {\"day\": \"2019-11-06T00:00:00\", \"num_issues\": 400.0}, {\"day\": \"2019-11-07T00:00:00\", \"num_issues\": 383.0}, {\"day\": \"2019-11-08T00:00:00\", \"num_issues\": 376.0}, {\"day\": \"2019-11-09T00:00:00\", \"num_issues\": 372.0}, {\"day\": \"2019-11-10T00:00:00\", \"num_issues\": 374.0}, {\"day\": \"2019-11-11T00:00:00\", \"num_issues\": 368.0}, {\"day\": \"2019-11-12T00:00:00\", \"num_issues\": 354.0}, {\"day\": \"2019-11-13T00:00:00\", \"num_issues\": 336.0}, {\"day\": \"2019-11-14T00:00:00\", \"num_issues\": 356.0}, {\"day\": \"2019-11-15T00:00:00\", \"num_issues\": 349.0}, {\"day\": \"2019-11-16T00:00:00\", \"num_issues\": 350.0}, {\"day\": \"2019-11-18T00:00:00\", \"num_issues\": 337.0}, {\"day\": \"2019-11-19T00:00:00\", \"num_issues\": 327.0}, {\"day\": \"2019-11-20T00:00:00\", \"num_issues\": 315.0}, {\"day\": \"2019-11-21T00:00:00\", \"num_issues\": 304.0}, {\"day\": \"2019-11-22T00:00:00\", \"num_issues\": 296.0}, {\"day\": \"2019-11-23T00:00:00\", \"num_issues\": 296.0}, {\"day\": \"2019-11-24T00:00:00\", \"num_issues\": 299.0}, {\"day\": \"2019-11-25T00:00:00\", \"num_issues\": 304.0}, {\"day\": \"2019-11-26T00:00:00\", \"num_issues\": 304.0}, {\"day\": \"2019-11-27T00:00:00\", \"num_issues\": 301.0}, {\"day\": \"2019-11-28T00:00:00\", \"num_issues\": 293.0}, {\"day\": \"2019-11-29T00:00:00\", \"num_issues\": 284.0}, {\"day\": \"2019-11-30T00:00:00\", \"num_issues\": 280.0}, {\"day\": \"2019-12-01T00:00:00\", \"num_issues\": 281.0}, {\"day\": \"2019-12-02T00:00:00\", \"num_issues\": 274.0}, {\"day\": \"2019-12-03T00:00:00\", \"num_issues\": 277.0}, {\"day\": \"2019-12-04T00:00:00\", \"num_issues\": 272.0}, {\"day\": \"2019-12-05T00:00:00\", \"num_issues\": 266.0}, {\"day\": \"2019-12-06T00:00:00\", \"num_issues\": 263.0}, {\"day\": \"2019-12-07T00:00:00\", \"num_issues\": 260.0}, {\"day\": \"2019-12-09T00:00:00\", \"num_issues\": 261.0}, {\"day\": \"2019-12-10T00:00:00\", \"num_issues\": 260.0}, {\"day\": \"2019-12-11T00:00:00\", \"num_issues\": 271.0}, {\"day\": \"2019-12-12T00:00:00\", \"num_issues\": 244.0}, {\"day\": \"2019-12-13T00:00:00\", \"num_issues\": 253.0}, {\"day\": \"2019-12-14T00:00:00\", \"num_issues\": 253.0}, {\"day\": \"2019-12-16T00:00:00\", \"num_issues\": 278.0}, {\"day\": \"2019-12-17T00:00:00\", \"num_issues\": 283.0}, {\"day\": \"2019-12-18T00:00:00\", \"num_issues\": 282.0}, {\"day\": \"2019-12-19T00:00:00\", \"num_issues\": 278.0}, {\"day\": \"2019-12-20T00:00:00\", \"num_issues\": 272.0}, {\"day\": \"2019-12-21T00:00:00\", \"num_issues\": 270.0}, {\"day\": \"2019-12-22T00:00:00\", \"num_issues\": 269.0}, {\"day\": \"2019-12-23T00:00:00\", \"num_issues\": 261.0}, {\"day\": \"2019-12-24T00:00:00\", \"num_issues\": 252.0}, {\"day\": \"2019-12-25T00:00:00\", \"num_issues\": 240.0}, {\"day\": \"2019-12-26T00:00:00\", \"num_issues\": 230.0}, {\"day\": \"2019-12-27T00:00:00\", \"num_issues\": 231.0}, {\"day\": \"2019-12-28T00:00:00\", \"num_issues\": 230.0}, {\"day\": \"2019-12-29T00:00:00\", \"num_issues\": 231.0}, {\"day\": \"2019-12-30T00:00:00\", \"num_issues\": 226.0}, {\"day\": \"2019-12-31T00:00:00\", \"num_issues\": 223.0}, {\"day\": \"2020-01-01T00:00:00\", \"num_issues\": 217.0}, {\"day\": \"2020-01-02T00:00:00\", \"num_issues\": 214.0}, {\"day\": \"2020-01-03T00:00:00\", \"num_issues\": 212.0}, {\"day\": \"2020-01-04T00:00:00\", \"num_issues\": 210.0}, {\"day\": \"2020-01-05T00:00:00\", \"num_issues\": 211.0}, {\"day\": \"2020-01-06T00:00:00\", \"num_issues\": 210.0}, {\"day\": \"2020-01-07T00:00:00\", \"num_issues\": 218.0}, {\"day\": \"2020-01-08T00:00:00\", \"num_issues\": 208.0}, {\"day\": \"2020-01-09T00:00:00\", \"num_issues\": 209.0}, {\"day\": \"2020-01-10T00:00:00\", \"num_issues\": 199.0}, {\"day\": \"2020-01-11T00:00:00\", \"num_issues\": 201.0}, {\"day\": \"2020-01-12T00:00:00\", \"num_issues\": 203.0}, {\"day\": \"2020-01-13T00:00:00\", \"num_issues\": 182.0}, {\"day\": \"2020-01-14T00:00:00\", \"num_issues\": 185.0}, {\"day\": \"2020-01-15T00:00:00\", \"num_issues\": 185.0}, {\"day\": \"2020-01-16T00:00:00\", \"num_issues\": 189.0}, {\"day\": \"2020-01-17T00:00:00\", \"num_issues\": 195.0}, {\"day\": \"2020-01-18T00:00:00\", \"num_issues\": 198.0}, {\"day\": \"2020-01-19T00:00:00\", \"num_issues\": 197.0}, {\"day\": \"2020-01-20T00:00:00\", \"num_issues\": 198.0}, {\"day\": \"2020-01-21T00:00:00\", \"num_issues\": 208.0}, {\"day\": \"2020-01-22T00:00:00\", \"num_issues\": 218.0}, {\"day\": \"2020-01-23T00:00:00\", \"num_issues\": 240.0}, {\"day\": \"2020-01-24T00:00:00\", \"num_issues\": 244.0}, {\"day\": \"2020-01-25T00:00:00\", \"num_issues\": 243.0}, {\"day\": \"2020-01-26T00:00:00\", \"num_issues\": 246.0}, {\"day\": \"2020-01-27T00:00:00\", \"num_issues\": 247.0}, {\"day\": \"2020-01-28T00:00:00\", \"num_issues\": 257.0}, {\"day\": \"2020-01-29T00:00:00\", \"num_issues\": 277.0}, {\"day\": \"2020-01-30T00:00:00\", \"num_issues\": 295.0}, {\"day\": \"2020-01-31T00:00:00\", \"num_issues\": 303.0}, {\"day\": \"2020-02-01T00:00:00\", \"num_issues\": 305.0}, {\"day\": \"2020-02-02T00:00:00\", \"num_issues\": 311.0}, {\"day\": \"2020-02-03T00:00:00\", \"num_issues\": 314.0}, {\"day\": \"2020-02-04T00:00:00\", \"num_issues\": 317.0}, {\"day\": \"2020-02-05T00:00:00\", \"num_issues\": 325.0}, {\"day\": \"2020-02-06T00:00:00\", \"num_issues\": 321.0}, {\"day\": \"2020-02-07T00:00:00\", \"num_issues\": 326.0}, {\"day\": \"2020-02-08T00:00:00\", \"num_issues\": 324.0}, {\"day\": \"2020-02-09T00:00:00\", \"num_issues\": 331.0}, {\"day\": \"2020-02-10T00:00:00\", \"num_issues\": 344.0}, {\"day\": \"2020-02-11T00:00:00\", \"num_issues\": 353.0}, {\"day\": \"2020-02-12T00:00:00\", \"num_issues\": 373.0}, {\"day\": \"2020-02-13T00:00:00\", \"num_issues\": 382.0}, {\"day\": \"2020-02-14T00:00:00\", \"num_issues\": 389.0}, {\"day\": \"2020-02-15T00:00:00\", \"num_issues\": 387.0}, {\"day\": \"2020-02-16T00:00:00\", \"num_issues\": 388.0}, {\"day\": \"2020-02-17T00:00:00\", \"num_issues\": 391.0}, {\"day\": \"2020-02-18T00:00:00\", \"num_issues\": 384.0}, {\"day\": \"2020-02-19T00:00:00\", \"num_issues\": 390.0}, {\"day\": \"2020-02-20T00:00:00\", \"num_issues\": 376.0}, {\"day\": \"2020-02-21T00:00:00\", \"num_issues\": 376.0}, {\"day\": \"2020-02-22T00:00:00\", \"num_issues\": 378.0}, {\"day\": \"2020-02-23T00:00:00\", \"num_issues\": 377.0}, {\"day\": \"2020-02-24T00:00:00\", \"num_issues\": 393.0}, {\"day\": \"2020-02-25T00:00:00\", \"num_issues\": 382.0}, {\"day\": \"2020-02-26T00:00:00\", \"num_issues\": 368.0}, {\"day\": \"2020-02-27T00:00:00\", \"num_issues\": 355.0}, {\"day\": \"2020-02-28T00:00:00\", \"num_issues\": 354.0}, {\"day\": \"2020-02-29T00:00:00\", \"num_issues\": 354.0}, {\"day\": \"2020-03-01T00:00:00\", \"num_issues\": 350.0}, {\"day\": \"2020-03-02T00:00:00\", \"num_issues\": 339.0}, {\"day\": \"2020-03-03T00:00:00\", \"num_issues\": 335.0}, {\"day\": \"2020-03-04T00:00:00\", \"num_issues\": 335.0}, {\"day\": \"2020-03-05T00:00:00\", \"num_issues\": 334.0}, {\"day\": \"2020-03-06T00:00:00\", \"num_issues\": 332.0}, {\"day\": \"2020-03-07T00:00:00\", \"num_issues\": 333.0}, {\"day\": \"2020-03-08T00:00:00\", \"num_issues\": 328.0}, {\"day\": \"2020-03-09T00:00:00\", \"num_issues\": 319.0}, {\"day\": \"2020-03-10T00:00:00\", \"num_issues\": 320.0}, {\"day\": \"2020-03-11T00:00:00\", \"num_issues\": 306.0}, {\"day\": \"2020-03-12T00:00:00\", \"num_issues\": 302.0}, {\"day\": \"2020-03-13T00:00:00\", \"num_issues\": 300.0}, {\"day\": \"2020-03-14T00:00:00\", \"num_issues\": 299.0}, {\"day\": \"2020-03-15T00:00:00\", \"num_issues\": 303.0}, {\"day\": \"2020-03-16T00:00:00\", \"num_issues\": 314.0}, {\"day\": \"2020-03-17T00:00:00\", \"num_issues\": 325.0}, {\"day\": \"2020-03-18T00:00:00\", \"num_issues\": 324.0}, {\"day\": \"2020-03-19T00:00:00\", \"num_issues\": 322.0}, {\"day\": \"2020-03-20T00:00:00\", \"num_issues\": 330.0}, {\"day\": \"2020-03-21T00:00:00\", \"num_issues\": 330.0}, {\"day\": \"2020-03-22T00:00:00\", \"num_issues\": 328.0}, {\"day\": \"2020-03-23T00:00:00\", \"num_issues\": 329.0}, {\"day\": \"2020-03-24T00:00:00\", \"num_issues\": 339.0}, {\"day\": \"2020-03-25T00:00:00\", \"num_issues\": 347.0}, {\"day\": \"2020-03-26T00:00:00\", \"num_issues\": 347.0}, {\"day\": \"2020-03-27T00:00:00\", \"num_issues\": 344.0}, {\"day\": \"2020-03-29T00:00:00\", \"num_issues\": 344.0}, {\"day\": \"2020-03-30T00:00:00\", \"num_issues\": 348.0}, {\"day\": \"2020-03-31T00:00:00\", \"num_issues\": 340.0}, {\"day\": \"2020-04-01T00:00:00\", \"num_issues\": 331.0}, {\"day\": \"2020-04-02T00:00:00\", \"num_issues\": 334.0}, {\"day\": \"2020-04-03T00:00:00\", \"num_issues\": 341.0}, {\"day\": \"2020-04-04T00:00:00\", \"num_issues\": 342.0}, {\"day\": \"2020-04-05T00:00:00\", \"num_issues\": 343.0}, {\"day\": \"2020-04-06T00:00:00\", \"num_issues\": 345.0}, {\"day\": \"2020-04-07T00:00:00\", \"num_issues\": 345.0}, {\"day\": \"2020-04-08T00:00:00\", \"num_issues\": 343.0}, {\"day\": \"2020-04-09T00:00:00\", \"num_issues\": 336.0}, {\"day\": \"2020-04-10T00:00:00\", \"num_issues\": 341.0}, {\"day\": \"2020-04-11T00:00:00\", \"num_issues\": 343.0}, {\"day\": \"2020-04-12T00:00:00\", \"num_issues\": 346.0}, {\"day\": \"2020-04-13T00:00:00\", \"num_issues\": 333.0}, {\"day\": \"2020-04-14T00:00:00\", \"num_issues\": 333.0}, {\"day\": \"2020-04-15T00:00:00\", \"num_issues\": 326.0}, {\"day\": \"2020-04-16T00:00:00\", \"num_issues\": 332.0}, {\"day\": \"2020-04-17T00:00:00\", \"num_issues\": 333.0}, {\"day\": \"2020-04-19T00:00:00\", \"num_issues\": 332.0}, {\"day\": \"2020-04-20T00:00:00\", \"num_issues\": 339.0}, {\"day\": \"2020-04-21T00:00:00\", \"num_issues\": 341.0}, {\"day\": \"2020-04-22T00:00:00\", \"num_issues\": 335.0}, {\"day\": \"2020-04-23T00:00:00\", \"num_issues\": 339.0}, {\"day\": \"2020-04-24T00:00:00\", \"num_issues\": 341.0}, {\"day\": \"2020-04-25T00:00:00\", \"num_issues\": 346.0}, {\"day\": \"2020-04-26T00:00:00\", \"num_issues\": 344.0}, {\"day\": \"2020-04-27T00:00:00\", \"num_issues\": 349.0}, {\"day\": \"2020-04-28T00:00:00\", \"num_issues\": 350.0}, {\"day\": \"2020-04-29T00:00:00\", \"num_issues\": 356.0}, {\"day\": \"2020-04-30T00:00:00\", \"num_issues\": 354.0}, {\"day\": \"2020-05-01T00:00:00\", \"num_issues\": 346.0}, {\"day\": \"2020-05-02T00:00:00\", \"num_issues\": 350.0}, {\"day\": \"2020-05-03T00:00:00\", \"num_issues\": 348.0}, {\"day\": \"2020-05-04T00:00:00\", \"num_issues\": 340.0}, {\"day\": \"2020-05-05T00:00:00\", \"num_issues\": 334.0}, {\"day\": \"2020-05-06T00:00:00\", \"num_issues\": 337.0}, {\"day\": \"2020-05-07T00:00:00\", \"num_issues\": 337.0}, {\"day\": \"2020-05-08T00:00:00\", \"num_issues\": 327.0}, {\"day\": \"2020-05-09T00:00:00\", \"num_issues\": 335.0}, {\"day\": \"2020-05-10T00:00:00\", \"num_issues\": 328.0}, {\"day\": \"2020-05-11T00:00:00\", \"num_issues\": 329.0}, {\"day\": \"2020-05-12T00:00:00\", \"num_issues\": 322.0}, {\"day\": \"2020-05-13T00:00:00\", \"num_issues\": 324.0}, {\"day\": \"2020-05-14T00:00:00\", \"num_issues\": 321.0}, {\"day\": \"2020-05-15T00:00:00\", \"num_issues\": 327.0}, {\"day\": \"2020-05-16T00:00:00\", \"num_issues\": 330.0}, {\"day\": \"2020-05-17T00:00:00\", \"num_issues\": 328.0}, {\"day\": \"2020-05-18T00:00:00\", \"num_issues\": 318.0}, {\"day\": \"2020-05-19T00:00:00\", \"num_issues\": 319.0}, {\"day\": \"2020-05-20T00:00:00\", \"num_issues\": 329.0}, {\"day\": \"2020-05-21T00:00:00\", \"num_issues\": 328.0}, {\"day\": \"2020-05-22T00:00:00\", \"num_issues\": 332.0}, {\"day\": \"2020-05-23T00:00:00\", \"num_issues\": 329.0}, {\"day\": \"2020-05-25T00:00:00\", \"num_issues\": 314.0}, {\"day\": \"2020-05-26T00:00:00\", \"num_issues\": 315.0}, {\"day\": \"2020-05-27T00:00:00\", \"num_issues\": 305.0}, {\"day\": \"2020-05-28T00:00:00\", \"num_issues\": 305.0}, {\"day\": \"2020-05-29T00:00:00\", \"num_issues\": 310.0}, {\"day\": \"2020-05-30T00:00:00\", \"num_issues\": 307.0}, {\"day\": \"2020-05-31T00:00:00\", \"num_issues\": 306.0}, {\"day\": \"2020-06-01T00:00:00\", \"num_issues\": 311.0}, {\"day\": \"2020-06-02T00:00:00\", \"num_issues\": 302.0}, {\"day\": \"2020-06-03T00:00:00\", \"num_issues\": 297.0}, {\"day\": \"2020-06-04T00:00:00\", \"num_issues\": 301.0}, {\"day\": \"2020-06-05T00:00:00\", \"num_issues\": 295.0}, {\"day\": \"2020-06-06T00:00:00\", \"num_issues\": 285.0}, {\"day\": \"2020-06-07T00:00:00\", \"num_issues\": 283.0}, {\"day\": \"2020-06-08T00:00:00\", \"num_issues\": 287.0}, {\"day\": \"2020-06-09T00:00:00\", \"num_issues\": 294.0}, {\"day\": \"2020-06-10T00:00:00\", \"num_issues\": 285.0}, {\"day\": \"2020-06-11T00:00:00\", \"num_issues\": 291.0}, {\"day\": \"2020-06-12T00:00:00\", \"num_issues\": 276.0}, {\"day\": \"2020-06-13T00:00:00\", \"num_issues\": 274.0}, {\"day\": \"2020-06-14T00:00:00\", \"num_issues\": 273.0}, {\"day\": \"2020-06-15T00:00:00\", \"num_issues\": 266.0}, {\"day\": \"2020-06-16T00:00:00\", \"num_issues\": 278.0}, {\"day\": \"2020-06-17T00:00:00\", \"num_issues\": 275.0}, {\"day\": \"2020-06-18T00:00:00\", \"num_issues\": 283.0}, {\"day\": \"2020-06-19T00:00:00\", \"num_issues\": 274.0}, {\"day\": \"2020-06-20T00:00:00\", \"num_issues\": 275.0}, {\"day\": \"2020-06-21T00:00:00\", \"num_issues\": 278.0}, {\"day\": \"2020-06-22T00:00:00\", \"num_issues\": 280.0}, {\"day\": \"2020-06-23T00:00:00\", \"num_issues\": 290.0}, {\"day\": \"2020-06-24T00:00:00\", \"num_issues\": 298.0}, {\"day\": \"2020-06-25T00:00:00\", \"num_issues\": 302.0}, {\"day\": \"2020-06-26T00:00:00\", \"num_issues\": 297.0}, {\"day\": \"2020-06-27T00:00:00\", \"num_issues\": 296.0}, {\"day\": \"2020-06-28T00:00:00\", \"num_issues\": 310.0}, {\"day\": \"2020-06-29T00:00:00\", \"num_issues\": 306.0}, {\"day\": \"2020-06-30T00:00:00\", \"num_issues\": 321.0}, {\"day\": \"2020-07-01T00:00:00\", \"num_issues\": 316.0}, {\"day\": \"2020-07-02T00:00:00\", \"num_issues\": 317.0}, {\"day\": \"2020-07-03T00:00:00\", \"num_issues\": 318.0}, {\"day\": \"2020-07-04T00:00:00\", \"num_issues\": 317.0}, {\"day\": \"2020-07-05T00:00:00\", \"num_issues\": 319.0}, {\"day\": \"2020-07-06T00:00:00\", \"num_issues\": 320.0}, {\"day\": \"2020-07-07T00:00:00\", \"num_issues\": 314.0}, {\"day\": \"2020-07-08T00:00:00\", \"num_issues\": 328.0}, {\"day\": \"2020-07-09T00:00:00\", \"num_issues\": 324.0}, {\"day\": \"2020-07-10T00:00:00\", \"num_issues\": 328.0}, {\"day\": \"2020-07-11T00:00:00\", \"num_issues\": 331.0}, {\"day\": \"2020-07-12T00:00:00\", \"num_issues\": 332.0}, {\"day\": \"2020-07-13T00:00:00\", \"num_issues\": 333.0}, {\"day\": \"2020-07-14T00:00:00\", \"num_issues\": 325.0}, {\"day\": \"2020-07-15T00:00:00\", \"num_issues\": 329.0}, {\"day\": \"2020-07-16T00:00:00\", \"num_issues\": 332.0}, {\"day\": \"2020-07-17T00:00:00\", \"num_issues\": 333.0}, {\"day\": \"2020-07-18T00:00:00\", \"num_issues\": 335.0}, {\"day\": \"2020-07-19T00:00:00\", \"num_issues\": 334.0}, {\"day\": \"2020-07-20T00:00:00\", \"num_issues\": 333.0}, {\"day\": \"2020-07-21T00:00:00\", \"num_issues\": 320.0}, {\"day\": \"2020-07-22T00:00:00\", \"num_issues\": 319.0}, {\"day\": \"2020-07-23T00:00:00\", \"num_issues\": 312.0}, {\"day\": \"2020-07-24T00:00:00\", \"num_issues\": 318.0}]}}, {\"mode\": \"vega-lite\"});\n",
       "</script>"
      ],
      "text/plain": [
       "alt.LayerChart(...)"
      ]
     },
     "execution_count": 24,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "issues_df = pd.DataFrame({\"day\": rolling_issue_count.index, \"num_issues\": rolling_issue_count.values})\n",
    "issues_df = issues_df.groupby(\"day\", as_index=False).max()\n",
    "\n",
    "# Truncate the first 28 days because it will be a windowing effect.\n",
    "chart = alt.Chart(issues_df[28:], title= \"New Issues (Last 28 Days)\")\n",
    "line = chart.mark_line().encode(\n",
    "  x= alt.X('day', title = \"Day\"),\n",
    "  y=alt.Y(\"num_issues\", title=\"# issues\"),    \n",
    ")\n",
    "\n",
    "point = line + line.mark_point()\n",
    "point.interactive()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 21,
   "metadata": {},
   "outputs": [
    {
     "ename": "ModuleNotFoundError",
     "evalue": "No module named 'matplotlib'",
     "output_type": "error",
     "traceback": [
      "\u001b[0;31m---------------------------------------------------------------------------\u001b[0m",
      "\u001b[0;31mModuleNotFoundError\u001b[0m                       Traceback (most recent call last)",
      "\u001b[0;32m<ipython-input-21-6baedf8ffd84>\u001b[0m in \u001b[0;36m<module>\u001b[0;34m\u001b[0m\n\u001b[0;32m----> 1\u001b[0;31m \u001b[0;32mimport\u001b[0m \u001b[0mmatplotlib\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m      2\u001b[0m \u001b[0;32mfrom\u001b[0m \u001b[0mmatplotlib\u001b[0m \u001b[0;32mimport\u001b[0m \u001b[0mpylab\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m      3\u001b[0m \u001b[0mmatplotlib\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mrcParams\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mupdate\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m{\u001b[0m\u001b[0;34m'font.size'\u001b[0m\u001b[0;34m:\u001b[0m \u001b[0;36m22\u001b[0m\u001b[0;34m}\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m      4\u001b[0m \u001b[0mhf\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mpylab\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mfigure\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m      5\u001b[0m \u001b[0mhf\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mset_size_inches\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;36m18.5\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;36m10.5\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n",
      "\u001b[0;31mModuleNotFoundError\u001b[0m: No module named 'matplotlib'"
     ]
    }
   ],
   "source": [
    "import matplotlib\n",
    "from matplotlib import pylab\n",
    "matplotlib.rcParams.update({'font.size': 22})\n",
    "hf = pylab.figure()\n",
    "hf.set_size_inches(18.5, 10.5)\n",
    "pylab.plot(rolling_issue_count, linewidth=5)\n",
    "ha = pylab.gca()\n",
    "ha.set_title(\"New Kubeflow Issues (28 Days)\")\n",
    "ha.set_xlabel(\"Date\")\n",
    "ha.set_ylabel(\"# Of Issues\")"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## GetSomeSampleIssue Events"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "query = \"\"\"\n",
    "SELECT\n",
    "    *\n",
    "  FROM `githubarchive.month.*`\n",
    "  WHERE\n",
    "    _TABLE_SUFFIX IN ({0})\n",
    "    AND type = 'IssuesEvent'\n",
    "    AND org.login = 'kubeflow'\n",
    "    \n",
    "    limit 20\n",
    "\"\"\".format(\",\".join(months))\n",
    "\n",
    "events=gbq.read_gbq(str(query), dialect='standard', project_id=PROJECT)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "events"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Get some sample pull request events \n",
    "\n",
    "* Want to inspect the data\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "query = \"\"\"\n",
    "SELECT\n",
    "    *\n",
    "  FROM `githubarchive.month.*`\n",
    "  WHERE\n",
    "    _TABLE_SUFFIX IN ({0})\n",
    "    AND type = 'PullRequestEvent'\n",
    "    AND org.login = 'kubeflow'\n",
    "    \n",
    "    limit 20\n",
    "\"\"\".format(\",\".join(months))\n",
    "\n",
    "events=gbq.read_gbq(str(query), dialect='standard', project_id=PROJECT)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "import pprint\n",
    "import json\n",
    "data = json.loads(events[\"payload\"].values[3])\n",
    "pprint.pprint(data)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "data[\"pull_request\"][\"id\"]"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Get Distinct Types"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "query = \"\"\"\n",
    "SELECT\n",
    "    distinct type\n",
    "  FROM `githubarchive.month.*`\n",
    "  WHERE\n",
    "    _TABLE_SUFFIX IN ({0})    \n",
    "    AND org.login = 'kubeflow'\n",
    "    \n",
    "    limit 20\n",
    "\"\"\".format(\",\".join(months))\n",
    "\n",
    "events=gbq.read_gbq(str(query), dialect='standard', project_id=PROJECT)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "events"
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.8.4rc1"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 4
}
